Skip to content

Instantly share code, notes, and snippets.

Shahbaz Javeed sjaveed

Block or report user

Report or block sjaveed

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sjaveed
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
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
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
end
end
@sjaveed
sjaveed / GIF-Screencast-OSX.md
Created Jun 1, 2017 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF
View GIF-Screencast-OSX.md

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

Instructions

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
score.winner
View gist:11206222
# Setup HTML::WhiteListSanitizer
ActionView::Base.sanitized_allowed_attributes.add('style')
%w/margin padding padding-left padding-right padding-top padding-bottom list-style/.each do |prop|
ActionView::Base.sanitized_allowed_css_properties.add(prop)
end
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="https://www.google.com" 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
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'
end
def nickname?
false
end
end
You can’t perform that action at this time.