Skip to content

Instantly share code, notes, and snippets.

View cristianp6's full-sized avatar

Cristian Pascottini cristianp6

View GitHub Profile
@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();
@Kilian
Kilian / annoying.js
Created January 6, 2011 15:04
How to be an asshole
/**
* Annoying.js - How to be an asshole to your users
*
* DO NOT EVER, EVER USE THIS.
*
* Copyright (c) 2011 Kilian Valkhof (kilianvalkhof.com)
* Visit https://gist.github.com/767982 for more information and changelogs.
* Visit http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/ for the introduction and weblog
* Check out https://gist.github.com/942745 if you want to annoy developer instead of visitors
*
@brtriver
brtriver / BasicAuthControllerProvider.php
Created February 4, 2012 20:36
Simple Basic Auth Controller for Silex.
<?php
namespace Silex\Provider;
use Silex\Application;
use Silex\SilexEvents;
use Silex\ControllerProviderInterface;
use Silex\ControllerCollection;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
@maddox
maddox / commands.md
Created February 29, 2012 06:37
Install script for Samba3

Install Samba 3 on OS X 10.7 Lion

Run the two commands below one at a time to get Samba 3 installed and to have it run on boot.

Install Samba with Homebrew

sh < <(curl https://raw.github.com/gist/1938575/df254d9a2ac83dddb04fcc7f9b634b65708aa477/

Set Samba up to launch on boot

@jjb3rd
jjb3rd / data.php
Created July 21, 2012 17:49
An updated server-side processing script for DataTables
<?php
/*
* Script: DataTables server-side script for PHP and MySQL
* Copyright: 2012 - John Becker, Beckersoft, Inc.
* Copyright: 2010 - Allan Jardine
* License: GPL v2 or BSD (3-point)
*/
class TableData {
@ticky
ticky / browser-regex.md
Last active October 19, 2023 23:13
Browser and Version regex

Browser and Version Regular Expression 2.0

(MSIE|(?!Gecko.+)Firefox|(?!AppleWebKit.+Chrome.+)Safari|(?!AppleWebKit.+)Chrome|AppleWebKit(?!.+Chrome|.+Safari)|Gecko(?!.+Firefox))(?: |\/)([\d\.apre]+)

This regular expression is capable of retrieving the browser and version for the following browsers;

  • Internet Explorer
  • Firefox (INCLUDING alpha and "pre" versions)
  • Other browsers reporting a "Gecko" version in their user agent
  • Chrome
  • Safari
  • Other browsers reporting an "AppleWebKit" version in their user agent
@nrk
nrk / MasterSlaveClusterInitializer.php
Created February 15, 2013 11:47
This is an example of a cluster (client-side sharding) of "virtual" nodes each one configured in a master/slave replication setup.
<?php
namespace Nrk\Predis;
use Nrk\Predis\Connection\MasterSlaveWrapperConnection;
use Predis\Cluster\Distribution\HashRing;
use Predis\Connection\PredisCluster;
use Predis\Option\ClientOptions;
class MasterSlaveClusterInitializer
@itsderek23
itsderek23 / ruby_cron_rvm_bundler.sh
Last active December 18, 2015 05:09
A sample shell script for a Ruby executable w/RVM + Bundler
#! /usr/bin/env bash
# Loading the RVM Environment files.
source /Users/dlite/.rvm/environments/ruby-1.9.2-p290
# Changing directories to your rails project.
cd /Users/dlite/projects/my_rails_app
# Call Scout and pass your unique key.
bundle exec scout [KEY]
@ragingwind
ragingwind / Backend Architectures Keywords and References.md
Last active April 17, 2024 10:51
Backend Architectures Keywords and References
@mwhite
mwhite / git-aliases.md
Last active June 18, 2024 05:31
The Ultimate Git Alias Setup

The Ultimate Git Alias Setup

If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands. It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory.

Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them.

The simplest way to add an alias for a specific git command is to use a standard bash alias.

# .bashrc