Skip to content

Instantly share code, notes, and snippets.

View kamalogudah's full-sized avatar

Paul Oguda kamalogudah

View GitHub Profile
@kamalogudah
kamalogudah / alias_matchers.md
Created September 30, 2021 16:52 — forked from JunichiIto/alias_matchers.md
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
@kamalogudah
kamalogudah / RUBY TRICKS
Created February 13, 2021 19:16
Ruby tips
ruby -cw filename.rb # checks for syntax errors
@kamalogudah
kamalogudah / stimulus.md
Created September 10, 2020 15:18 — forked from mrmartineau/stimulus.md
Stimulus cheatsheet
@kamalogudah
kamalogudah / neo4j_cypher_cheatsheet.md
Created June 18, 2019 14:52 — forked from DaniSancas/neo4j_cypher_cheatsheet.md
Neo4j's Cypher queries cheatsheet

Neo4j Tutorial

Fundamentals

Store any kind of data using the following graph concepts:

  • Node: Graph data records
  • Relationship: Connect nodes (has direction and a type)
  • Property: Stores data in key-value pair in nodes and relationships
  • Label: Groups nodes and relationships (optional)
@kamalogudah
kamalogudah / example_job.rb
Created June 11, 2019 21:39 — forked from hopsoft/example_job.rb
Render views outside of the standard request context (i.e. ActiveJob) with Devise/Warden
class ExampleJob < ApplicationJob
queue_as :default
def perform(user)
# do some work
# HACK: get around limitations in devise/warden when rendering
# views outside the context of a formal http request
renderer = ::ApplicationController.renderer.new
renderer_env = renderer.instance_eval { @env }
@kamalogudah
kamalogudah / app.DockerFile
Created May 19, 2019 18:55 — forked from satendra02/app.DockerFile
docker+rails+puma+nginx+postgres (Production ready)
FROM ruby:2.3.1
# Install dependencies
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
# Set an environment variable where the Rails app is installed to inside of Docker image:
ENV RAILS_ROOT /var/www/app_name
RUN mkdir -p $RAILS_ROOT
# Set working directory, where the commands will be ran:
# sum elements in a list
defmodule ListHelper do
def sum([]), do: 0
def sum([head | tail]), do: head + sum(tail)
end
# if clause
if condition, do: something, else: another_thing
# cond
// asserting errors
console.assert(condition, error to throw);
// clear console logs
console.clear()
// number of times a function is called
console.count(label)
// displaying document
console.dir(document.body); // shows as an object
console.dirxml(document.body); // shows as xml
// console error
@kamalogudah
kamalogudah / vimcheat.txt
Created December 17, 2018 11:28
Vim Cheat
hjkl- moving up, down, left , and right.
x - deleting from a cursor
:q! - quit without saving.
:wq - quit and save
dw - delete word until start of next word.
d$ - delete entire line.
de - delete word until end of current word.
2w - move cursor two word forward.
3e - move cursor to the end of the third word forward.
0 - move cursor to the start of teh line.
#list allcontainers
docker container ls --all
# run a docker container and show hostname
docker container run alpine hostname
# run an ubuntu container and access its shell
docker container run --interactive --tty --rm ubuntu bash
# running mysqlexample
docker container run \
--detach \
--name mydb \