Skip to content

Instantly share code, notes, and snippets.

@aslam
aslam / varnish3.rb
Last active September 6, 2017 04:39 — forked from wearethefoos/varnish3.rb
Install Varnish-3.0.2 on OSX with homebrew
##
# Install Varnish 3.0.2 on OSX with the following Brew command:
# $> brew install https://gist.githubusercontent.com/aslam/022ec19fb9b1b1b96c99c09b2f43d9c3/raw/d731e4bb44830a352397e3cb79f1aea47bed6483/varnish3.rb
#
# You also might have to run:
# $> sudo brew link varnish3
# To symlink the install.
##
require 'formula'
@aslam
aslam / about.md
Created August 9, 2011 14:22 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@aslam
aslam / generate-pushid.js
Created June 21, 2017 19:40 — forked from mikelehen/generate-pushid.js
JavaScript code for generating Firebase Push IDs
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/
@aslam
aslam / ceasar_cipher.rb
Created November 16, 2018 11:07
A simple implementation of Caesar's Cipher.
puts "Welcome!"
puts "Please enter the phrase you wish to encrypt: "
phrase = gets.chomp
puts "Enter factor: "
factor = gets.chomp.to_i
ALPHABETS = {
'lower' => [nil, ('a'..'z').to_a].flatten,
'upper' => [nil, ('A'..'Z').to_a].flatten
}
# Implement a method #substrings that takes a word as the first argument and then
# an array of valid substrings (your dictionary) as the second argument.
# It should return a hash listing each substring (case insensitive) that was found
# in the original string and how many times it was found.
```
> substrings("Howdy partner, sit down! How's it going?", dictionary)
=> { "down" => 1, "how" => 2, "howdy" => 1,"go" => 1, "going" => 1, "it" => 2, "i" => 3, "own" => 1,"part" => 1,"partner" => 1,"sit" => 1 }
```
dictionary = ["below","down","go","going","horn","how","howdy","it","i","low","own","part","partner","sit"]
@aslam
aslam / .vimrc
Created November 2, 2021 18:08 — forked from millermedeiros/.vimrc
My VIM settings (.vimrc)
" =============================================================================
" Miller Medeiros .vimrc file
" -----------------------------------------------------------------------------
" heavily inspired by: @factorylabs, @scrooloose, @nvie, @gf3, @bit-theory, ...
" =============================================================================
" -----------------------------------------------------------------------------
" BEHAVIOR