Skip to content

Instantly share code, notes, and snippets.

@jed
jed / LICENSE.txt
Created May 20, 2011 13:27 — forked from 140bytes/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@jwreagor
jwreagor / less-middleware.js
Created December 18, 2011 00:44
less.js connect middleware for node use
/*!
* Less.js middleware for Connect via Stylus's middleware
*
* THIS IS A HACK! Hold over till less.js gets their own sanctioned middleware or
* I personally convert all of Twitter's Bootstrap to Stylus.
*
* Copyright(c) 2010 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/
@EvanDotPro
EvanDotPro / gittyup.sh
Created December 21, 2011 17:15
Easily keep master in sync with upstream.
####################################################################################
## ##
## gittyup() - Easily keep master in sync with upstream. ##
## ##
## Author: Evan Coury, http://blog.evan.pro/ ##
## URL: https://gist.github.com/1506822 ##
## ##
## This bash function is a simple shortcut for keeping your local (and public ##
## fork / origin remote) master branch up to date and in sync with the upstream ##
## master. To use gittyup(), simply drop this in your ~/.bashrc. ##
@boucher
boucher / StripeTutorialPage.html
Created February 6, 2012 07:05
Stripe Tutorial Payment Form
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Getting Started Form</title>
<script type="text/javascript" src="https://js.stripe.com/v1/"></script>
<!-- jQuery is used only for this example; it isn't required to use Stripe -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
// this identifies your website in the createToken call below
@DASPRiD
DASPRiD / gist:2404837
Created April 17, 2012 09:22
Locale or language in URL
<?php
use Zend\EventManager\StaticEventManager;
use Zend\Mvc\MvcEvent;
use Locale;
$events = StaticEventManager::getInstance();
$events->attach('Zend\Mvc\Application', 'route', function(MvcEvent $event){
$request = $event->getRequest();
$uri = $request->uri();
$baseUrlLength = strlen($request->getBaseUrl() ?: '');
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@shevron
shevron / Uri.php
Created June 18, 2012 18:18
Zend Framework 2.0 Uri validator
<?php
namespace Zend\Validator;
class Uri extends AbstractValidator
{
const INVALID = 'uriInvalid';
protected $_messageTemplates = array(
self::INVALID => "Provided input is not a valid URL"
------------------------------------------------------------------------------
To be added (Zend\I18n namespace):
View helpers:
- DateFormat <DASPRiD>
- NumberFormat <cgmartin>
- Currency <cgmartin>
------------------------------------------------------------------------------
Convert to work with DateTime, Intl extension and/or Zend\I18n\Translator:
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@cgmartin
cgmartin / pre-commit
Last active October 9, 2015 06:17
ZF2 Git pre-commit hook
#!/usr/bin/env php
<?php
/**
* .git/hooks/pre-commit
*
* This pre-commit hooks will check for PHP errors (lint), and make sure the
* code is PSR-2 compliant.
*
* Dependecy: PHP-CS-Fixer (https://github.com/fabpot/PHP-CS-Fixer)
*/