Skip to content

Instantly share code, notes, and snippets.

View abhas's full-sized avatar

Abhas Abhinav abhas

View GitHub Profile
#! /bin/sh
set -e
# This script originates from http://www.debian.org/mirror/anonftpsync
# CVS: cvs.debian.org:/cvs/webwml - webwml/english/mirror/anonftpsync
# Version: $Id: anonftpsync,v 1.43 2008-06-15 18:16:04 spaillar Exp $
# Note: You MUST have rsync 2.6.4 or newer, which is available in sarge
# and all newer Debian releases, or at http://rsync.samba.org/
/*!
* jQuery TextChange Plugin
* http://www.zurb.com/playground/jquery-text-change-custom-event
*
* Copyright 2010, ZURB
* Released under the MIT License
*/
(function ($) {
$.event.special.textchange = {
@kdwinter
kdwinter / authenticable.rb
Created June 14, 2010 21:52
Authlogic with Mongoid (in spirit of http://pastie.org/503478)
module Authenticable
def self.included(model)
model.class_eval do
extend ClassMethods
include InstanceMethods
field :username
field :email
field :crypted_password
field :password_salt
@masatomo
masatomo / sequence.rb
Created December 6, 2010 18:19
adds a feature to set sequence number to Mongoid::Document
# encoding: utf-8
module Mongoid #:nodoc:
# Include this module to add automatic sequence feature
# usage:
# Class KlassName
# include Mongoid::Document
# include Mongoid::Sequence
# ...
# field :number, :type=>Integer
# sequence :number
@wisq
wisq / gist:1507733
Created December 21, 2011 21:14
Why I love zsh (and hate being forced to use bash)

Why I love zsh (and hate being forced to use bash)

  • Smarter completion. A few examples:
  • context sensitive -- if you have file "name1" and directory "name2", "cd nam<TAB>" completes to "name2/"
  • "tar xf <TAB>" completes to tarballs only. "unrar x <TAB>" completes to RARs only. etc.
  • rsync / scp completion: "rsync host:anything/<TAB>" shows you files on host under anything/
  • also works with rsync:// URLs
  • SSH host completion from ~/.ssh/config & ~/.ssh/known_hosts
  • lots of other smart completions: Rake tasks, git commands & SHAs, dpkg packages, dash-options for most commands, etc etc.
@abitgone
abitgone / bootstrap-grid.css
Created February 29, 2012 14:47
Grid Overlay for Twitter Bootstrap
/*
* Grid Overlay for Twitter Bootstrap
* Assumes a 1.692em baseline grid (22px/13px)
*/
@media (min-width: 1200px) {
body {
background: -webkit-gradient(linear, top left, bottom left, color-stop(0%, rgba(0, 0, 0, 0.05)), color-stop(4.545%, rgba(0, 0, 0, 0.05)), color-stop(4.545%, rgba(0, 0, 0, 0)), color-stop(100%, rgba(0, 0, 0, 0))), -webkit-gradient(linear, top left, top right, color-stop(0%, rgba(0, 0, 0, 0)), color-stop(35%, rgba(0, 0, 0, 0)), color-stop(35%, rgba(0, 0, 0, 0.05)), color-stop(36%, rgba(0, 0, 0, 0.05)), color-stop(36%, rgba(0, 0, 0, 0)), color-stop(65%, rgba(0, 0, 0, 0)), color-stop(65%, rgba(0, 0, 0, 0.05)), color-stop(66%, rgba(0, 0, 0, 0.05)), color-stop(66%, rgba(0, 0, 0, 0)), color-stop(100%, rgba(0, 0, 0, 0))), -webkit-gradient(linear, top left, top right, color-stop(0%, rgba(0, 0, 0, 0)), color-stop(0%, rgba(0, 0, 0, 0.1)), color-stop(0.085%, rgba(0, 0, 0, 0.1)), color-stop(0.085%, rgba(0, 0, 0, 0)));
background: -webkit-linear-gradient(90deg, rgba(0, 0, 0, 0.05), rgba(
@ahoward
ahoward / grid_fs.rb
Created April 17, 2012 16:42
implementation of grid_fs on top of mongoid
require "mime/types"
require "digest/md5"
require "cgi"
### see: http://www.mongodb.org/display/DOCS/GridFS+Specification
class GridFS
##
#
attr_accessor :prefix
require "mongo"
require "open-uri"
require "mime/types"
require "digest/md5"
class Upload
##
#
include Mongoid::Document
include Mongoid::Timestamps
@hayajo
hayajo / gist:2848763
Created June 1, 2012 04:27
fluentd qmail-send log format
format /^(?<tai64>[^ ]+) (?<message>(((?:new|end) msg (?<key>[0-9]+)|info msg (?<key>[0-9]+): bytes (?:\d+) from <(?<address>[^>]*)> |starting delivery (?<delivery_id>[0-9]+): msg (?<key>[0-9]+) to (?:local|remote) (?<address>.+)|delivery (?<delivery_id>[0-9]+))?.*))$/
@netmarkjp
netmarkjp / gist:2881651
Created June 6, 2012 12:53
fluentd qmail log parser(tcpserver)
<source>
type tail
format /^(?<time>[^ ]* *[^ ]* [^ ]*) (?<host>[^ ]*) qmail: (?<unixtime>[^ ]*) (?<event>[^ ]*) msg (?<msg>[^ ]*)$/
time_format %b %d %H:%M:%S
path /tmp/maillog
pos_file /tmp/fluentd.pos.1
tag maillog.qmail
</source>
<source>