Skip to content

Instantly share code, notes, and snippets.


Vikash Vikram vikashvikram

View GitHub Profile
vikashvikram / elix_tut.ex
Created Mar 28, 2018
Elixir Cheat sheet
View elix_tut.ex
# Vikram March 28, 2018
# Based on video on elixir by Derek
# commands to run: iex, c("elix_tut.ex"), M.main
defmodule M do
def main do
# string_stuff()
# math_stuff()
# compare_stuff()
# decision_stuff()
# tuple_stuff()
vikashvikram / nginx.conf
Last active Mar 13, 2016
A sample nginx.conf file setting nginx and passenger for a ruby on rails application.
View nginx.conf
#user nobody;
worker_processes 8;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/;
vikashvikram /
Last active Aug 22, 2019
How to setup nginx and passenger for a ruby on rails application on Mac OS X

Setting up nginx with passenger for a Ruby on Rails app on Mac OSX

Nginx with passenger is a very popular choice for production and staging environment for rails applications. It is always a good practice to replicate the production and staging environments on our local systems so that we do not have last minute surprises while deploying. Most of the Ruby on Rails developers use Mac OS as their development environment so this document is regarding setting up Nginx with on it for an already existing rails app. The assumption for this doc is that you do not even have ruby installed on your system. So feel free to skip the steps that are not relevant.

Installing Ruby, setting up Rails app, installing gems and nginx

The recommended way to work on a rails app is to use rvm for installing ruby. We need to have multiple versions of ruby and our gems

View Neo4j.rb
# get the sample rails app
# git clone
# in case you are using neo4j with rails app, run follwoing commands to setup
rake neo4j:install[community-latest]
# to start a neo4j server from rails app
rake neo4j:start[development]
# start neo4j shell from a rails app
View frankenstein_hash.rb
# FrankensteinHash is a subclass of Hash
# It lets you create many levels of keys in Hash at one go.
class FrankensteinHash < Hash
def [](key)
fetch(key) {|el| self[el] =}
h =
h["a"]["b"]["c"] = 1 #=> 1
View basics.swift
//: Playground - noun: a place where people can play
import UIKit
var constantString = "Hi"
var str: String? = "Hello, playground"
//str = nil
vikashvikram / sample.ts
Created May 19, 2015
Sample code for TypeScript language
View sample.ts
var isDone: boolean = false;
//As in JavaScript, all numbers in TypeScript are floating point values.
var height: number = 6;
console.log('isDone: ', isDone);
console.log('height: ', height)
var name: string = "bob";
name = 'smith';
vikashvikram / join.go
Created May 14, 2015
Join integer array elements with a string e.g. [1,2,3,4] => "1, 2, 3, 4"
View join.go
package main
import (
func Join(arr []int64, str string) string {
result := ""
last_index := len(arr) - 1
vikashvikram / combinations.go
Created May 14, 2015
Get all combinations of a given number of items from an array of int64 items (can type as per your requirement).
View combinations.go
package main
import (
func GetAllSubsets(arr []int64, size int) [][]int64{
if len(arr) == size {
result := [][]int64{arr}
return result
vikashvikram / slice.go
Created May 14, 2015
Examples of how to use slices in Go programming language
View slice.go
package main
import (
func AddOneToEachElement(slice []int) {
for i := range slice {