Skip to content

Instantly share code, notes, and snippets.

@yaychris
yaychris / gist:285410
Created January 24, 2010 19:54
1.in? [2, 3]
# Turn this:
# [1, 2].include? 3
#
# Into this:
# 3.in? [1, 2]
#
# Why? Shorter, more readable conditionals:
# puts 'booya' if 3.in? [1, 2]
class Object
config = SimpleConfig.new
config.load_file File.join(File.dirname(__FILE__), "sample.rb")
config.get(:foo) #=> "bar"
config[:save_path] #=> "/var/www/download"
$ rpm help
RPM version 4.4.2.3
Copyright (C) 1998-2002 - Red Hat, Inc.
This program may be freely redistributed under the terms of the GNU GPL
Usage: rpm [-aKfgpWHqV] [-aKfgpWHqVcdils] [-aKfgpWHqVcdilsaKfgpWHqV] [-aKfgpWHqVcdilsaKfgpWHqV] [-aKfgpWHqVcdilsaKfgpWHqV] [-aKfgpWHqVcdilsaKfgpWHqVK] [-aKfgpWHqVcdilsaKfgpWHqVK] [-aKfgpWHqVcdilsaKfgpWHqVKi] [-aKfgpWHqVcdilsaKfgpWHqVKiv] [-aKfgpWHqVcdilsaKfgpWHqVKiv] [-aKfgpWHqVcdilsaKfgpWHqVKiv?] [-a|--all] [-f|--file] [-g|--group]
[-p|--package] [-W|--ftswalk] [--pkgid] [--hdrid] [--fileid]
[--specfile] [--triggeredby] [--whatrequires] [--whatprovides]
[--nomanifest] [-c|--configfiles] [-d|--docfiles] [--dump] [-l|--list]
[--queryformat=QUERYFORMAT] [-s|--state] [--nomd5] [--nofiles]
@yaychris
yaychris / php-fastcgi
Created January 4, 2012 19:25
ubuntu php fastcgi init.d script
#! /bin/sh
### BEGIN INIT INFO
# Provides: php-fastcgi
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop php-cgi in external FASTCGI mode
# Description: Start and stop php-cgi in external FASTCGI mode
### END INIT INFO
@yaychris
yaychris / id_rsa.pub
Created February 23, 2012 22:36
Public Key
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAtrRGakN2WRoXUIHhIVTg2d87EselCvRfI/Not+eE3gAQRm9m1v7hWGM6gDUTNnUGmda5+rHZgbxvrLwLTxNj3HmJNwQ63iiij6FdWk3f7mK8mBqnz7oPjwEF8HO/R1eJPenSe/C4KLyRVUHmmfbDDsJ6EALoy6+t4/VJFbi3NjnxftfxWIoiFw9R4FkmsDamuPue3wzA+qexhWhEEXDzOlLy6O+Nt47lfnWSRZPOKLc+kMljfq1NA2+ct+hnqVurSqpm332M27QdLucPmG/Jzo1EO/Pyp3it9KJAJ/qn9QcfiODL2rUnk9ZQTnm9ctEhdrTPeCyqBIJ+idYMt3LsKw== Chris@Callisto.local
@yaychris
yaychris / tlc.lua
Created March 28, 2012 16:39 — forked from fjolnir/tlc.lua
LuaJIT ObjC bridge
-- TLC - The Tiny Lua Cocoa bridge
-- Note: Only tested with LuaJit 2 Beta 9 on x86_64 with OS X >=10.7.3 & iPhone 4 with iOS 5
-- Copyright (c) 2012, Fjölnir Ásgeirsson
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
@yaychris
yaychris / git-completion.sh
Created September 18, 2012 17:14
Git Completion
#!bash
#
# bash completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAtrRGakN2WRoXUIHhIVTg2d87EselCvRfI/Not+eE3gAQRm9m1v7hWGM6gDUTNnUGmda5+rHZgbxvrLwLTxNj3HmJNwQ63iiij6FdWk3f7mK8mBqnz7oPjwEF8HO/R1eJPenSe/C4KLyRVUHmmfbDDsJ6EALoy6+t4/VJFbi3NjnxftfxWIoiFw9R4FkmsDamuPue3wzA+qexhWhEEXDzOlLy6O+Nt47lfnWSRZPOKLc+kMljfq1NA2+ct+hnqVurSqpm332M27QdLucPmG/Jzo1EO/Pyp3it9KJAJ/qn9QcfiODL2rUnk9ZQTnm9ctEhdrTPeCyqBIJ+idYMt3LsKw== Chris@Callisto.local
module SimplestAuth
module Model
def self.included(base)
adapters.each do |adapter|
if adapter.registered?(base)
include adapter
end
end
end
function fish_prompt
set_color green
echo -n (pwd | sed "s!^$HOME!~!")
set_color cyan
if test -d .git
echo -n '' (git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1]/")
if [ (git status 2> /dev/null | tail -n1) != 'nothing to commit, working directory clean' ]