Skip to content

Instantly share code, notes, and snippets.

View gabssnake's full-sized avatar

gabssnake gabssnake

View GitHub Profile
@gabssnake
gabssnake / .gitconfig
Last active August 29, 2015 13:57
git config file
[core]
excludesfile = ~/.gitignore_global
editor = subl
[color]
ui = auto
diff = auto
status = auto
branch = auto
interactive = auto
grep = always
/**
* jQuery.support.cssProperty
* To verify that a CSS property is supported (or any of its browser-specific implementations)
*
* @param string p - css property name
* [@param] bool rp - optional, if set to true, the css property name will be returned, instead of a boolean support indicator
*
* @Author: Axel Jack Fuchs (Cologne, Germany)
* @Date: 08-29-2010 18:43
*
@gabssnake
gabssnake / css-hex-to-rgba
Last active August 29, 2015 14:03
Convert CSS hex color to rgba() with opacity
// adapted from awesomest http://gist.github.com/lrvick/2080648
var hexToRGB = function ( hex ) {
var r,g,b;
hex = parseInt( hex.replace('#',''), 16 );
r = hex >> 16;
g = hex >> 8 & 0xFF;
b = hex & 0xFF;
return [r,g,b];
};
@gabssnake
gabssnake / __ js placeholder mini polyfill.js
Created September 2, 2014 14:52
placeholder polyfill
// simple placeholder polyfill (requires jQuery)
// http://snippetrepo.com/snippets/html5-placeholder-on-ie8-input-fields
(function($, document){
var test = document.createElement('input');
var polyfill = function () {
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');

Mac OS X 10.10 Yosemite

Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

Install Software

wget \
--recursive \
--no-parent \
--page-requisites \
--no-clobber \
--html-extension \
--convert-links \
--restrict-file-names=windows \
@gabssnake
gabssnake / SimpleSpy.js
Created October 2, 2015 12:14
Javascript Spy on object method. Keeps the arguments of each call and can be later destroyed
function Spy (object, method) {
var original = object[method];
var spy = {
calls: [],
destroy: function () {
object[method] = original;
}
};
object[method] = function () {
var args = Array.prototype.slice.call(arguments);
@gabssnake
gabssnake / index.js
Last active January 20, 2017 21:05
Bloomrun perf tests
'use strict'
var async = require('async')
var dependency = require('bloomrun')
var tests = require('./tests')
function measure (test) {
return function (i, done) {
var time = process.hrtime()
test(err => done(err, process.hrtime(time)))
@gabssnake
gabssnake / scrdec18-VC8.exe
Created September 1, 2017 16:54 — forked from bcse/scrdec18-VC8.exe
Windows Script Decoder 1.8 (Decoding JScript.Encoded)
@gabssnake
gabssnake / FizzBuzz.js
Created December 21, 2017 07:47
FizzBuzz
// Separate rules from work
const rules = { '3': 'Fizz', '5': 'Buzz' }
const fbuzz = i => Object.keys(rules).reduce((s, n) => s + (i % n ? '' : rules[n]), '') || i
for (let i = 1; i <= 100; i++) console.log(fbuzz(i))