Skip to content

Instantly share code, notes, and snippets.

View nervetattoo's full-sized avatar

Raymond Julin nervetattoo

View GitHub Profile
.jg .image img {
border: 1px solid silver;
padding: 4px;
width: 300px;
height: 300px;
}
.jg li {
opacity: .7;
border: 1px solid #999;
float: left;
We couldn’t find that file to show.
git stash; git checkout master; git pull; git checkout search; git merge master; git stash apply
<?php
$transport = new ElasticSearchTransportHTTP("localhost", 9200);
$search = new ElasticSearchClient($transport, "1311", "affiliates");
$query = array(
'query' => array(
'bool' => array(
'must' => array(
array(
'query_string' => array(
@nervetattoo
nervetattoo / Photo.php
Created November 1, 2010 20:26
Initial image handler route
<?php
class Photo extends \lithium\data\Model {
/**
* Generate a cached version under webroot
* @param string $id The image id as in mongodb
* @param array $options Possible values are
* width
<?php
Validator::add('array', function(&$value, $format = null, array $options = array()) {
$options += array(
'threshold' => 0,
'validator' => 'notEmpty'
);
if (is_array($value)) {
$failed = 0;
$valueCount = count($value);
foreach ($value as $item) {
convert image.jpg profile.icc
convert image.jpg -profile profile.icc -profile /path/to/sRGB_IEC61966-2-1_black_scaled.icc -trim working-image.jpg
var defaultTime = new Date(Date.now() + 3600 * 1000);
var hours = [];
for (var i = 0; i < 24; i++)
{
hours.push({
value : ("0" + i).slice(-2),
selected : (defaultTime.getHours() == i)
});
}
@nervetattoo
nervetattoo / associativity-reference.php
Created May 4, 2011 08:48
Associativity and return by reference in PHP
<?php
$objects = array(new stdClass, new stdClass);
while ($o =& next($objects) && true)
var_dump($o); // stdClass object
reset($objects);
while ($o = next($objects) && true)
var_dump($o); // true
// Fix
@nervetattoo
nervetattoo / Makefile
Created May 11, 2011 18:35 — forked from wolever/Makefile
Arduino OS X makefile
# ====
# NOTE
# ====
# This may be out of date; see the comments below.
# Arduino 0017 Makefile
# Arduino adaptation by mellis, eighthave, oli.keller,
# alex norman [with help from http://code.google.com/p/arduino/issues/detail?id=65#c5]
# Version 0017/Mac modifications made by
# David Wolever : http://dorkbotpdx.org/blog/ax/arduino_0017_makefile