Skip to content

Instantly share code, notes, and snippets.

Lower Your Eyelids To Die With The Sun

Tomas Carnecky wereHamster

Lower Your Eyelids To Die With The Sun
View GitHub Profile
View _curl-effect.scss
/* Stupid compass box-shadow mixin doesn't support multiple shadows... */
@mixin box-shadow-2($first, $second) {
$full: $first, $second;
@include experimental(box-shadow, $full, -moz, -webkit, -o, not -ms, not -khtml, official);
@mixin curl-effect-shadow($corner) {
z-index: -1;
position: absolute;
wereHamster / gmail-backup
Created Apr 17, 2011
gmail backup script
View gmail-backup
/usr/bin/offlineimap -u Noninteractive.Quiet
cd "$HOME/gmail"
test -z "$(git status -s)" && exit
git ls-files --deleted -z | xargs -0 git rm --cached
git ls-files --modified --others -z | xargs -0 git update-index --add
git commit --quiet -m "..."
View gist:925159
# begin
# if lock = Lock.acquire('indexing')
# ...
# end
# ensure
# lock.release if lock
# end
# Host: MacBook 2.4GHz Core 2 Duo
View gist:925165
class CreateLocksTable < ActiveRecord::Migration
def self.up
create_table :locks, :id => false do |t|
t.string :name
t.string :owner
t.datetime :time
add_index :locks, :name
wereHamster /
Created Apr 20, 2011
bash-like brace expansion in coffee-script
{ _ } = require 'underscore'
assert = require 'assert'
expand = (path) ->
tokens = _.compact path.split /({|}|,)/
merge = (array, element) ->
(el + element) for el in array
wereHamster / git-clear-whitespace
Created Jun 9, 2011
Clear all trailing whitespace in files modified since "$1"
View git-clear-whitespace
for FILE in `exec git diff --name-only "$1" --`; do
sed -E -i '' 's/[[:space:]]*$//' "$FILE"
class Unit
@create: (options) ->
# This is the object which will hold the private data.
privData = {}
# We create a new unit and pass it the privData object.
unit = new Unit privData, options
# Wrap all methods and pass privData as the first argument. This incurs
wereHamster / Coffeescript ctags
Created Oct 19, 2011 — forked from mads-hartmann/Coffeescript ctags
ctags definitions for Coffeescript. Very basic for now. "> ctags -e -R source_folder" and then M-. to jump to the definition of any function or variable (if you're using emacs)
View Coffeescript ctags
# Detects classes, static/class methods, plain functions and variables.
--regex-coffee=/^class ([A-Za-z.]+)( extends [A-Za-z.]+)?$/\1/c,class/
--regex-coffee=/^[ \t]*@?([A-Za-z.]+):.*[-=]>.*$/\1/f,function/
--regex-coffee=/^[ \t]*([A-Za-z.]+)[ \t]+=.*[-=]>.*$/\1/f,function/
--regex-coffee=/^[ \t]*([A-Za-z.]+)[ \t]+=[^->\n]*$/\1/v,variable/
View sendmail.js
var spawn = require('child_process').spawn;
exports.send = function(email, config, callback) {
var path = typeof config === "string" ? config : "sendmail";
// Spawn sendmail. When it exits invoke the callback.
child = spawn(path, [ '-t' ]);
child.on('exit', function(code, signal) {
if (code !== 0) {
callback && callback(code, null);
View mail-archiver.rb
#!/usr/bin/env ruby
require 'pathname'
require 'mail'
class Archiver
attr_reader :maildir, :time
def initialize(maildir)
@maildir = maildir