Skip to content

Instantly share code, notes, and snippets.

@sriprasanna
sriprasanna / Res.sh
Last active August 29, 2015 14:17 — forked from Garland-g/Res.sh
#!/bin/bash
#Author: Travis Gibson
#This script requires an argument for the resolution width
#Thanks go out to eCharles for a patch in the comments of this link here: http://blog.echarles.net/2013/10/01/Ubuntu-13.04-On-MacbookPro-Retina
if [ -z "$1" ]; then
echo "Usage: Res.sh <resolution_width>";
exit 1;
fi
erg=$( echo "$1")
check=$(xrandr -q | grep DP-2 | cut -d " " -f 4 | cut -d "x" -f 1)

Sample Project

Starting from:

lein new foo
cd foo

Say I have a random JAR file that is not available in any repository:

touch README.md

@sriprasanna
sriprasanna / gist:2465475
Created April 22, 2012 17:24
Reddit ranking algorithm in Ruby
#!/Users/dustyeike/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
require "rubygems"
require "test/unit"
require "date"
EPOCH = Date.new(1970, 1, 1)
#
# Returns the number of seconds from the epoch to date
def epoch_seconds date
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
# Reincarnation for classes
class Class
def reincarnate
buried = Object.__send__(:remove_const, self.name)
Object.const_set(self.name, Class.new(buried))
end
end
class Abc