Skip to content

Instantly share code, notes, and snippets.

@remy
remy / gist:350433
Created March 31, 2010 14:58
Storage polyfill
if (typeof window.localStorage == 'undefined' || typeof window.sessionStorage == 'undefined') (function () {
var Storage = function (type) {
function createCookie(name, value, days) {
var date, expires;
if (days) {
date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();
@bjhess
bjhess / st_cheat.txt
Created January 11, 2012 21:39
Sublime Text Cheatsheet
Navigation:
cmd-p Goto Anything ('@' for functions, ':' for line number)
cmd-r Function finder
ctl-g Goto line number
cmd-sft-p Command palette
cmd-sft-f Find in Files
cmd-opt-r Toggle regex when finding
cmd-opt-# Columns
ctr-# Switch columns
@cuppster
cuppster / node-express-cors-middleware.js
Created April 9, 2012 16:02
express.js middleware to support CORS pre-flight requests
app.use(express.methodOverride());
// ## CORS middleware
//
// see: http://stackoverflow.com/questions/7067966/how-to-allow-cors-in-express-nodejs
var allowCrossDomain = function(req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization');
@liamdon
liamdon / gist:2467603
Created April 22, 2012 23:53
CoffeeScript, Jade and Stylus syntax highlighting in Sublime Text 2

Step 1: Clone the bundles into your Sublime Text packages directory

cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages
git clone git://github.com/jashkenas/coffee-script-tmbundle CoffeeScript
git clone https://github.com/miksago/jade-tmbundle.git Jade
git clone https://github.com/LearnBoost/stylus.git Stylus

Step 2: Restart Sublime Text 2

@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
@swapnilmishra
swapnilmishra / Gruntfile.js
Last active December 20, 2015 17:09
Handle development/production HTML linkings of resources such as JS,CSS so that in development, you would have 2 or more link/script tags but in production you would just point to the minified versions.
module.exports = function(grunt) {
grunt.initConfig({
/*
copy header-template.html which will have placeholders for injecting css,js
*/
copy: {
main: {
files: [
@rrosiek
rrosiek / install_mysql.sh
Last active June 5, 2023 07:08
Vagrant provision script for php, Apache, MySQL, phpMyAdmin, Laravel, and javascript helpers. Tested with Ubuntu 16.04.
#! /usr/bin/env bash
###
#
# install_mysql.sh
#
# This script assumes your Vagrantfile has been configured to map the root of
# your application to /vagrant and that your web root is the "public" folder
# (Laravel standard). Standard and error output is sent to
# /vagrant/vm_build.log during provisioning.
var cheerio = require('cheerio');
var request = require('request');
request.get('http://gshow.globo.com/programas/na-moral/videos/feed.atom', function(err, headers, body){
if(err)
throw err;
if(headers.statusCode !== 200)
throw new Error('Resposta não OK.');
var cheerio = require('cheerio');
var request = require('request');
var url = 'http://www.americanas.com.br/produto/7112345/geladeira-refrigerador-frost-free-brastemp-clean-brm39-352-litros-inox';
request.get(url, function(err, res, body){
if(err)
throw err;
if(res.statusCode !== 200)
throw new Error('Resporta não OK ' + res.statusCode);
@davidfowl
davidfowl / dotnetlayout.md
Last active May 5, 2024 11:47
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/