Skip to content

Instantly share code, notes, and snippets.

<?hh
async function stream_check(resource $stream, string $mode, int $usec): Awaitable<void>
{
$r = $w = $e = null;
do {
if ($mode == "r") {
$r = Vector{$stream};
}
@raganwald
raganwald / record.js
Last active August 29, 2015 14:03
Records, Values, and Structs
function Record (template) {
if (Record.prototype.isPrototypeOf(this)) {
var struct = this;
Object.keys(template).forEach(function (key) {
Object.defineProperty(struct, key, {
enumerable: true,
writable: true,
value: template[key]
});

Lambda the Ultimate

On page 137 of The Little Schemer, this rather convoluted function appears:

(define multirember&co
  (lambda (a lat col)
    (cond
      ((null? lat)
       (col (quote ()) (quote ())))
@low
low / ee_clean-install.sql
Created April 16, 2009 08:14
Cleans up a new ExpressionEngine installation
# get rid of template groups
TRUNCATE TABLE exp_template_groups;
INSERT INTO exp_template_groups
(group_name, group_order, is_site_default)
VALUES
('home', '1', 'y');
# get rid of templates
TRUNCATE TABLE exp_templates;
INSERT INTO exp_templates
#!/bin/bash
#
# This script creates symlinks from a self contained directory to theirappropriate
# places in your site directory, allowing you to maintain addons as Git submodules.
addon_dir="submodule_addons"
# FieldFrame
ln -sf ../"$addon_dir"/bk.fieldframe.ee_addon/extensions/ext.fieldframe.php ../extensions/ext.fieldframe.php
ln -sf ../../"$addon_dir"/bk.fieldframe.ee_addon/language/english/lang.fieldframe.php ../language/english/lang.fieldframe.php
<?php
/*
EE2 hidden configuration variables
Last updated: Jun 20 2010
Obtain this list by putting print_r($this->EE->config->config); on a PHP-enabled template.
See: http://eeinsider.com/tips/view/config-overrides-for-ee-1-and-2/
*/
@adactio
adactio / datalist.html
Created January 9, 2011 17:24
Progressive enhancement with datalist
<!DOCTYPE html>
<title>Datalist test</title>
<meta charset="utf-8">
<form>
<label for="source">How did you hear about us?</label>
<datalist id="sources">
<select name="source">
<option>please choose...</option>
<option value="television">Television</option>
<option value="radio">Radio</option>
@shanestillwell
shanestillwell / nameparse.php
Created July 6, 2011 01:11
Parse names in PHP
<?
/*
Name: nameparse.php
Version: 0.2a
Date: 030507
First: 030407
License: GNU General Public License v2
Bugs: If one of the words in the middle name is Ben (or St., for that matter),
or any other possible last-name prefix, the name MUST be entered in
last-name-first format. If the last-name parsing routines get ahold
@airways
airways / QUERY_PARAM.md
Created July 19, 2011 22:24
ExpressionEngine: new QUERY_PARAM protocol that always works

QUERY_PARAM Protocol

This is a simple technique which should work on ALL hosts to allow ExpressionEngine to handle URLs without index.php in them. Hopefully EllisLab will add this as a built-in option soon.

IJR

@curtisblackwell
curtisblackwell / index.html
Created August 13, 2011 10:03
Cache and resize images in entries using Lumis imgsizer, Matrix, and Stash
{!--
# FIELDS
1. Matrix: images
* File: image
* PT Pill: alignment (left, right, or block)
* Text: description
* PT Pill: width
2. Textarea/WYSIWYG: body