Skip to content

Instantly share code, notes, and snippets.

@jgv
jgv / opacity.scss
Last active March 26, 2017 21:42
Cross-browser sass/scss mixin for opacity down to IE 5
@mixin hp-opacity($trans) {
filter: alpha(opactiy=($trans * 100));
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=#{$trans * 100})";
-moz-opacity: $trans;
-khtml-opacity: $trans;
opacity: $trans;
}
@jgv
jgv / crockford's lost joke
Created December 8, 2010 00:27
lost joke from javascript the good parts
var flight = {
airline: "Oceanic",
number: 815,
departure: {
IATA: "SYD",
time: "2004-09-22 14:55",
city: "Sydney"
},
arrival: {
IATA: "LAX",
@jgv
jgv / gist:731093
Created December 6, 2010 22:22
js test for birthday party. pls fork.
partyTime = new Date(2010,12,11,23,30,0);
yrTime = new Date();
/// test for party
var checkForParty = function (yrTime, partyTime){
if (yrTime < partyTime) {
return false;
} else {
return true;
}
@wizardishungry
wizardishungry / meatball.estimate
Last active September 24, 2015 10:07
estimate number of meatballs remaining in freezer
initial estimate: 234
current: 0
@ryanb
ryanb / github_tree_slider.js
Created December 6, 2010 17:23
This is how GitHub's new AJAX file browser works.
GitHub.TreeSlider = function () {
if (window.history && window.history.pushState) {
function a() {
if (e.sliding) {
e.sliding = false;
$(".frame-right").hide();
$(".frame-loading:visible").removeClass("frame-loading")
}
}
if (!($("#slider").length == 0 || !GitHub.shouldSlide)) if (!navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
@jgv
jgv / screenshots
Created November 23, 2010 07:02
osx screenshots in a custom dir
defaults write com.apple.screencapture location ~/your/path
killall SystemUIServer
@jgv
jgv / aliases
Created November 19, 2010 17:04
bash aliases
# aliases - commands
alias ls='ls -l -G'
alias la='ls -a'
alias rmdir="rm -rf"
alias jsmin='~/sites/jsmin/jsmin'
alias sw='sass --watch'
alias pd='pwd'
alias sinatra='ruby -rubygems
# aliases - navigation
@xavi-
xavi- / gist:633341
Created October 19, 2010 00:15
Interview gist -- Can candidate write code?

Instructions

  • Solve all problems using JavaScript

Problems

  1. Write a function that returns an array with the first n powers of 2. Call it twoPow.

  2. Use twoPow and Array.prototype.reduce to the sum of the first 10 powers of 2.

  3. Describe this call signature:

@xavi-
xavi- / gist:633087
Created October 18, 2010 21:21 — forked from jimbojw/gist:583389
Interview gist -- Can candidate read, debug, and fix code?
// For each of the following code fragments:
// a. what does the code do?
// b. what did the author intend for it to do?
// c. how would you fix it?
// NOTE: all code samples work exactly the same in all browsers
// 1. object literals
var data = [ { high: 100, low: 81 }, { high: 93, low: 73 }, { high: 60, low: 32 } ];
function getAverages(data) {
var avgs = [];
# CommitBot
# An interface for audibly broadcasting commit messages
# Tested on OSX
# Created by the friendly team at Hunch.com (sharing is caring!)
#
# Installation
# 1. replace USERNAME, PASSWORD, and HOSTNAME below
# 2. ...
# 3. profit!