Skip to content

Instantly share code, notes, and snippets.

@mathiasbynens
mathiasbynens / appify
Created November 12, 2010 13:46 — forked from subtleGradient/appify
appify — create the simplest possible Mac app from a shell script
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
@athos
athos / gist:1033052
Created June 18, 2011 12:34
An example code to generate a class with ASM in Clojure.
(import '[clojure.asm Opcodes Type ClassWriter]
'[clojure.asm.commons Method GeneratorAdapter])
(defn make-class [name]
(let [cw (ClassWriter. ClassWriter/COMPUTE_FRAMES)
init (Method/getMethod "void <init>()")
meth (Method/getMethod "int fact(int)")]
(.visit cw Opcodes/V1_6 Opcodes/ACC_PUBLIC (.replace name \. \/) nil "java/lang/Object" nil)
(doto (GeneratorAdapter. Opcodes/ACC_PUBLIC init nil nil cw)
(.visitCode)
@guilleiguaran
guilleiguaran / application_helper.rb
Created August 15, 2011 20:44
CoffeeScript inside your views templates
# coffee_script_tag
# Usage:
#
# <%= coffee_script_tag do %>
# alert 'Hello World'
# <% end %>
#
#
# You will get in your page:
#
@esundahl
esundahl / color_test.sh
Created January 21, 2012 03:19
Bash Color Test
function color_test {
# Daniel Crisman's ANSI color chart script from
# The Bash Prompt HOWTO: 6.1. Colours
# http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
#
# This function echoes a bunch of color codes to the
# terminal to demonstrate what's available. Each
# line is the color code of one forground color,
# out of 17 (default + 16 escapes), followed by a
# test use of that color on all nine background
@chetan
chetan / yardoc_cheatsheet.md
Last active May 10, 2024 02:53
YARD cheatsheet
@schlamar
schlamar / processify.py
Last active June 11, 2024 12:46
processify
import os
import sys
import traceback
from functools import wraps
from multiprocessing import Process, Queue
def processify(func):
'''Decorator to run a function as a process.
Be sure that every argument and the return value
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@axelpale
axelpale / combinations.js
Last active July 7, 2023 10:37
JavaScript functions to calculate combinations of elements in Array.
/**
* Copyright 2012 Akseli Palén.
* Created 2012-07-15.
* Licensed under the MIT license.
*
* <license>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
1981:cms $ rspec ./spec/models/sqs_queue_processor_spec.rb -fs --color
/Users/xxx.yyy/.rvm/gems/ruby-1.9.3-p286@mew_cms/gems/padrino-core-0.10.6/lib/padrino-core/reloader.rb:106:in `block in lock!': undefined method `split' for name(.):XPath::Expression::Name (NoMethodError)
from /Users/xxx.yyy/.rvm/gems/ruby-1.9.3-p286@mew_cms/gems/padrino-core-0.10.6/lib/padrino-core/reloader.rb:106:in `map'
from /Users/xxx.yyy/.rvm/gems/ruby-1.9.3-p286@mew_cms/gems/padrino-core-0.10.6/lib/padrino-core/reloader.rb:106:in `lock!'
from /Users/xxx.yyy/.rvm/gems/ruby-1.9.3-p286@mew_cms/gems/padrino-core-0.10.6/lib/padrino-core/loader.rb:68:in `load!'
from /Users/xxx.yyy/Documents/work/cms/config/boot.rb:66:in `<top (required)>'
from /Users/xxx.yyy/Documents/work/cms/spec/spec_helper.rb:2:in `require'
from /Users/xxx.yyy/Documents/work/cms/spec/spec_helper.rb:2:in `<top (required)>'
from /Users/xxx.yyy/Documents/work/cms/spec/models/sqs_queue_processor_spec.rb:1:in `requir
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active July 17, 2024 14:20
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

Instructions

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