This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. :( | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "readline" | |
require "fileutils" | |
class CompileObjectiveC | |
attr_accessor :code_lines | |
TMP_DIR = "/tmp" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "readline" | |
require "pry" | |
require "fileutils" | |
class CompileObjectiveC | |
attr_accessor :code_lines | |
TMP_DIR = "/tmp" | |
def initialize |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)) |