Skip to content

Instantly share code, notes, and snippets.

View arikon's full-sized avatar

Sergey Belov arikon

  • Yandex
  • Tivat, Montenegro
View GitHub Profile
@isaacs
isaacs / .gitconfig
Created June 8, 2012 19:01
These are my shortcuts for git.
# A bunch of the stuff above relies on this, especially the aliases.
[user]
# you probably want to change this bit.
name = isaacs
email = i@izs.me
signingkey = 0x6C481CF6
[alias]
ci = commit
st = status
br = branch
@cowboy
cowboy / Abstraction.js
Created May 24, 2012 20:25
A modern JavaScript if-elseif-else abstraction, because control flow statements are so 1995
/*
* Abstraction.js
*
* Copyright (c) 2012 "Cowboy" Ben Alman
* Licensed under the MIT license.
* http://benalman.com/about/license/
*/
var Abstraction = (function($) {
var _ = $.prototype;
/*
In a child process, each of the stdio streams may be set to
one of the following:
1. A new file descriptor in the child, dup2'ed to the parent and
exposed to JS as a Stream object.
2. A copy of a file descriptor from the parent, with no other
added magical stuff.
3. A black hole - no pipe created.
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@rooreynolds
rooreynolds / things_beta_list_completed_tasks.sh
Created March 9, 2012 23:39
Extracting useful data from Things (Cloud beta) via its SQLite database
#Completed tasks (showing their title, start date, completion date and time to complete in days)
sqlite3 -csv -header ~/Library/Application\ Support/Cultured\ Code/Things\ beta/ThingsLibrary.db "SELECT
substr(ZTITLE,0,26) as title,
datetime(ZCREATIONDATE, 'unixepoch', '+31 years', 'localtime') as startdate,
datetime(ZSTOPPEDDATE, 'unixepoch', '+31 years', 'localtime') as completeddate,
round(julianday(datetime(ZSTOPPEDDATE, 'unixepoch', '+31 years', 'localtime')) - julianday
(datetime(ZCREATIONDATE, 'unixepoch', '+31 years', 'localtime')),5) as age
FROM ZTHING WHERE ZSTATUS = 3 ORDER BY completeddate;
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@dalethedeveloper
dalethedeveloper / gist:1503252
Created December 20, 2011 21:00
Mobile Device Detection via User Agent RegEx

#Mobile Device Detection via User Agent RegEx

Yes, it is nearly 2012 and this exercise has been done to death in every imaginable language. For my own purposes I needed to get the majority of non-desktop devices on to a trimmed down, mobile optimized version of a site. I decided to try and chase down an up-to-date RegEx of the simplest thing that could possibly work.

I arrived at my current solution after analyzing 12 months of traffic over 30+ US based entertainment properties (5.8M+ visitors) from Jan - Dec 2011.

The numbers solidified my thoughts on the irrelevancy of including browsers/OSes such as Nokia, Samsung, Maemo, Symbian, Ipaq, Avant, Zino, Bolt, Iris, etc. The brass tacks of the matter is that you certainly could support these obscure beasts, but are you really going to test your site on them? Heck, could you even find one?! Unless the folks that pay you are die hard Treo users my guess is "No".

Interestingly enough my research shows that /Mobile/ is more efficient than **/iP(

@tommeier
tommeier / xvfb_daemon.sh
Created April 27, 2011 10:44
Xvfb startup init script for headless selenium with multiple displays for Jenkins or Teamcity CI server
#!/bin/bash
# /etc/init.d/xvfb_daemon
# Xvfb startup script.
# Tom Meier <tom@venombytes.com>
#
### BEGIN INIT INFO
# Provides: xvfb
# Short-Description: Start/stop/restart daemon
# Description: Controls the Xvfb daemon which starts/stops the X Virtual Framebuffer server
# Example Use: