Skip to content

Instantly share code, notes, and snippets.

View michaelcullum's full-sized avatar

Michael Cullum michaelcullum

View GitHub Profile
@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

@jwage
jwage / SplClassLoader.php
Last active April 9, 2024 21:04
Add MIT license.
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
@callumacrae
callumacrae / build-tools.md
Last active October 25, 2023 15:14
Build tools written in JavaScript
@igorw
igorw / gist:2145730
Last active May 22, 2023 13:23
Composer PR Template

Composer is a new dependency manager for PHP. It allows you to specify dependencies on a per-project basis. It takes lots of inspiration from NPM and ruby's bundler.

All you need to support composer is a composer.json file. In order to allow easy installation, the repository needs to be added to packagist, which is the standard repository for composer. Packagist will fetch all the versions from your github repository tags.

Once it has been added, adding {PROJECT} to a project will be as easy as creating this composer.json file in the project's directory:

{
    "require": {
        "{VENDOR}/{PROJECT}": "{VERSION}"

}

#!/bin/sh
# Compile a list of changed files
FILES=`git diff --name-only HEAD^`
# Attempt to fix whitespace issues
for FILE in `egrep -l '(\s$| {1,3}\t)' $FILES`
do
# Remove trailing whitespace
(sed -i 's/[ ]*$//' $FILE > /dev/null 2>&1 || sed -i '' -E 's/[ ]*$//' $FILE)
MODNAME = Some MOD
VERSION = 1.0.0
PACKAGENAME = QuotePostBackLink.zip
PACKAGEFILES = install.xml license.txt modx.prosilver.en.xsl root
CURL = /usr/bin/curl
GIT = /usr/bin/git
.title:
@echo "$(MODNAME) - $(VERSION)\n"
@JeffreyWay
JeffreyWay / presentationPrep.js
Created April 6, 2012 22:11
I wish it could be that simple. Something for me to build.
presentation
.title('My Great Presentation')
.slide({
title: 'Learn About Borders',
bullets: [
'Thing 1',
'Thing 2',
],
code: ['path/to/file.css', [2,4]] // path to file, lines to grab

AJAXified actions

Board

  • global: delete cookies
  • index: mark all forums read
  • memberlist_view (viewprofile): add as friend/foe
  • viewforum: watch forum, mark topics read
  • viewtopic: watch topic, bookmark topic, bump topic, delete post, approve post, quickmod
@nickvergessen
nickvergessen / check_duplicated_language_keys.php
Created March 14, 2012 12:17
Language File Conflict Detector
<?php
/**
*
* @package Language File Conflict Detector
* @version $Id$
* @copyright (c) 2012 nickvergessen nickvergessen@gmx.de http://www.flying-bits.org
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
@michaelcullum
michaelcullum / extension.json
Created February 15, 2012 11:04
Sample manifest.json
{
"name": "phpbb-blog/phpbb-blog",
"type": "phpbb3-extension",
"description": "An super cool example manifest extension.",
"homepage": "https://gist.github.com/gists/1835060",
"version": "1.0.0",
"time": "2012-02-15",
"licence": "GNU GPL v2",
"authors": [{
"name": "Michael Cullum",