Skip to content

Instantly share code, notes, and snippets.

sjaveed / gist:22426672f799f58c9d7c5850b3f1da45
Created Mar 18, 2019 — forked from jimbojsb/gist:1630790
Code highlighting for Keynote presentations
View gist:22426672f799f58c9d7c5850b3f1da45

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

sjaveed / .bash_profile
Created Nov 1, 2017
bash helper functions for docker
View .bash_profile
# Docker-related functions and aliases
# Include these into your ~/.bash_profile; don't replace your ~/.bash_profile with this
alias dc="docker-compose"
alias dcr="docker-compose run --rm"
alias dce="docker-compose exec"
sjaveed / cluster_colors.rb
Created Sep 25, 2017
Clustering Colors using Affinity Propagation
View cluster_colors.rb
#!/usr/bin/env ruby
require 'bundler/setup'
require 'affinity_propagation'
require 'byebug'
module AffinityPropagation
class Calculator
attr_accessor :availabilities, :responsibilities, :similarities
sjaveed /
Created Jun 1, 2017 — forked from dergachev/
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF


To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

View game.rb
class Game < ActiveRecord::Base
belongs_to :schedule
belongs_to :contestant_a, polymorphic: true
belongs_to :contestant_b, polymorphic: true
has_one :score, dependent: :destroy
def winner
View gist:11206222
# Setup HTML::WhiteListSanitizer
%w/margin padding padding-left padding-right padding-top padding-bottom list-style/.each do |prop|
original_string = %Q|<h1 style="color: #333 !important; font-family: arial !important; font-size: 45px !important; font-style: normal !important; font-weight: normal !important; margin: 0 0 10px 0 !important; line-height:-0.5px !important;">Test heading;<a href="" style="color: #F3724E   !important; font-family: arial !important; text-decoration: none !important;"> link text</a>&nbsp;:&nbsp;</h1>|
sanitized_string = ActionView::Base.white_list_sanitizer.sanitize(original_string)
sjaveed / gist:7765208
Created Dec 3, 2013
Declaring Private Methods on on a Specific Instance of a Class in Ruby
View gist:7765208
class Person
def name
nickname? ? 'Bob' : 'Robert'
def nickname?
You can’t perform that action at this time.