Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#
# Copyright 2013 John Leach <[email protected]>
#
# Distributed under terms of the MIT license
#
# Takes a screeshot using scrot and uploads it via scp and sticks the
# url on the clipboard as quickly as possible.
#
# For speed, it cheats and puts the url on the clipboard *before*
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
var width = canvas.width;
var height = canvas.height;
var i = 0;
// inset box shadow alpha values
var shades = [140, 163, 184, 201, 217, 229, 240, 247, 252];
// draw inset box shadow
module Foo
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def metaclass; class << self; self; end; end
def hello(name = nil)
if name
run <<-CMD.compact
cd -- #{deploy_to.shellescape}/ &&
LC_COLLATE=C sort REQUIRED_ASSETS -o REQUIRED_ASSETS &&
cd -- #{shared_path.shellescape}/assets/ &&
for f in $(
find * -mmin +#{expire_after_mins.to_s.shellescape} -type f | LC_COLLATE=C sort |
LC_COLLATE=C comm -23 -- - #{deploy_to.shellescape}/REQUIRED_ASSETS
); do
echo "Removing unneeded asset: $f";
rm -f -- "$f";
desc "Remove branches that are merged to master"
task :grm do
branch_string = `git branch --merged master`
branches = branch_string.strip.split("\n")
branches.each do |branch_name|
branch_name.strip!
unless branch_name =~ /master/
print "Deleting branch #{branch_name} y/n: "
char = STDIN.gets()
if char.is_a?(Fixnum)
1. Until very recently there was a bug where if href has '#' in it, when you scroll through dropdown it will be automatically closed. (https://github.com/ivaynberg/select2/issues/425)
2. For selects dynamically created selects (for js templates), the positioning is all screwed up on scroll.https://github.com/ivaynberg/select2/issues/149#issuecomment-7542630
3. Forgetting some which we worked around. :(
@gnufied
gnufied / obj.rb
Last active December 11, 2015 03:28
objective c reply
#!/usr/bin/env ruby
require "readline"
require "fileutils"
class CompileObjectiveC
attr_accessor :code_lines
TMP_DIR = "/tmp"
require "readline"
require "pry"
require "fileutils"
class CompileObjectiveC
attr_accessor :code_lines
TMP_DIR = "/tmp"
def initialize
#!/usr/bin/env ruby
require "fileutils"
require "set"
class GetShitDone
attr_accessor :hosts_file
def initialize
@hosts_file = "/etc/hosts"
@banned_sites_file = "#{ENV['HOME']}/.banned_sites"
@gnufied
gnufied / compile_rspec.el
Created December 6, 2012 09:14
compile_rspec.el
(require 'cl) ; If you don't have it already
(defun* get-closest-gemfile-root (&optional (file "Gemfile"))
"Determine the pathname of the first instance of FILE starting from the current directory towards root.
This may not do the correct thing in presence of links. If it does not find FILE, then it shall return the name
of FILE in the current directory, suitable for creation"
(let ((root (expand-file-name "/"))) ; the win32 builds should translate this correctly
(loop
for d = default-directory then (expand-file-name ".." d)
if (file-exists-p (expand-file-name file d))