Skip to content

Instantly share code, notes, and snippets.

@yuval-a
yuval-a / js-micro.js
Last active Aug 25, 2021
Javascript micro-optimizations
View js-micro.js
// Array literal (= []) is faster than Array constructor (new Array())
// http://jsperf.com/new-array-vs-literal/15
var array = [];
// Object literal (={}) is faster than Object constructor (new Object())
// http://jsperf.com/new-array-vs-literal/26
var obj = {};
// property === undefined is faster than hasOwnProperty(property)
// Note: don't use this in cases where 'undefined' is a possible value for your properties
@staltz
staltz / introrx.md
Last active Sep 20, 2021
The introduction to Reactive Programming you've been missing
View introrx.md
View git-help.md

How to get a remote repository (from BitBucket, GitHub or anyone)

$ git clone https://github.com/<username>/<repository>.git

If you have added a SSH key, then you can also use this command:

$ git clone git@bitbucket.org:<username>/<repository>.git

How to create a new repository from the command line

@plentz
plentz / nginx.conf
Last active Sep 13, 2021
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
View nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@johnkoht
johnkoht / grid.css.sass
Last active Jul 30, 2021
Bootstrap 3 Style Grid built on Bourbon Neat
View grid.css.sass
// Main containers
.container
@include outer-container
// Rows
.row
@include row()
// A basic column without a defined width or height
@mailtruck
mailtruck / colormeter.js
Created Apr 18, 2012 — forked from krypton/colormeter.js
Calculate difference in percentage between 2 hex colors
View colormeter.js
function color_meter(cwith, ccolor) {
if (!cwith && !ccolor) return;
var _cwith = (cwith.charAt(0)=="#") ? cwith.substring(1,7) : cwith;
var _ccolor = (ccolor.charAt(0)=="#") ? ccolor.substring(1,7) : ccolor;
var _r = parseInt(_cwith.substring(0,2), 16);
var _g = parseInt(_cwith.substring(2,4), 16);
var _b = parseInt(_cwith.substring(4,6), 16);
View Fancy File Inputs.js
var SITE = SITE || {};
SITE.fileInputs = function() {
var $this = $(this),
$val = $this.val(),
valArray = $val.split('\\'),
newVal = valArray[valArray.length-1],
$button = $this.siblings('.button'),
$fakeFile = $this.siblings('.file-holder');
if(newVal !== '') {