Skip to content

Instantly share code, notes, and snippets.

View wilr's full-sized avatar

Will Rossiter wilr

View GitHub Profile
@wilr
wilr / generate_animated_photos.sh
Last active August 29, 2015 14:03
Generate an animated sequence of photos. I used iPhoto export to generate a Images folder of images at a set size and resolution.
#!/bin/bash
# normalize filenames exported from iPhoto to XXXX.jpg so that the frames come
# out in order
cd Images
for f in *.jpg; do
num=`basename $f .jpg | cut -d '.' -f 1`
name=`printf "%0.4i.jpg\n" $num`
[ ! -f $name ] && mv $f $name
done
@wilr
wilr / whic.sh
Created March 9, 2014 22:24
What Have I Changed? with several git repos in a project, this lists changes in all of them
#!/usr/bin/env bash
path=`pwd`
chil="/*/"
path=$path$chil
for i in $path; do
cd $i
if [ -d ".git" ]; then
echo -e "==> \033[1m$i\033[0m"
git status
diff --git a/dev/FixtureBlueprint.php b/dev/FixtureBlueprint.php
index e74bdee..3e95004 100644
--- a/dev/FixtureBlueprint.php
+++ b/dev/FixtureBlueprint.php
@@ -128,27 +128,53 @@ class FixtureBlueprint {
// Populate all relations
if($data) foreach($data as $fieldName => $fieldVal) {
if($obj->many_many($fieldName) || $obj->has_many($fieldName)) {
+ $obj->write();
+
@wilr
wilr / banners.html
Last active August 29, 2015 13:56
CSS3 animated colors
<div class="demo_container">
<div class="gradient gradient_1" aria-role="presentation"><!-- --></div>
<div class="gradient gradient_2" aria-role="presentation"><!-- --></div>
<div class="gradient gradient_3" aria-role="presentation"><!-- --></div>
<div class="gradient gradient_4" aria-role="presentation"><!-- --></div>
<div class="gradient gradient_5" aria-role="presentation"><!-- --></div>
<div class="gradient gradient_6" aria-role="presentation"><!-- --></div>
<div class="gradient gradient_7" aria-role="presentation"><!-- --></div>
</div>
public function getNextSibling() {
return Page::get()->filter(array(
'ParentID' => $this->ParentID,
'Sort:GreaterThan' => $this->Sort
))->sort('Sort', 'ASC')->First();
}
@wilr
wilr / gist:7350807
Created November 7, 2013 08:02
Homebrew version of the Macports guide (https://gist.github.com/wilr/3168208).

Install Apache 2, MySQL 5 and PHP 5 on Mac OS X using Homebrew:

This is a Homebrewed version of https://gist.github.com/wilr/3168208/. Note that this is just a random collection of thoughts at this stage and hasn't been used in a while. I use sprout-wrap to build new machines. To see how DNA machines function, see our build at https://github.com/dnadesign/sprout-wrap

Preparation

  • Install Xcode: Grab it from App Store
  • Install Command line tools in xcode (open xcode -> Preferences -> Downloads -> Command Line tools)
  • Install Homebrew: http://brew.sh

Remove MacPorts

/**
* Returns the statuses near this one.
*
* @return DataList
*/
public static function get_by_lat_lng($lat, $lng, $filter = "") {
$sql = new SQLQuery();
$sql->select = array(
"Status.*",
"Status.ID AS ID",
This file has been truncated, but you can view the full file.
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by configure, which was
generated by GNU Autoconf 2.65. Invocation command line was
$ ./configure --prefix=/usr/local/Cellar/php54/5.4.19 --localstatedir=/usr/local/var --sysconfdir=/usr/local/etc/php/5.4 --with-config-file-path=/usr/local/etc/php/5.4 --with-config-file-scan-dir=/usr/local/etc/php/5.4/conf.d --with-iconv-dir=/usr --enable-dba --with-ndbm=/usr --enable-exif --enable-soap --enable-wddx --enable-ftp --enable-sockets --enable-zip --enable-shmop --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-mbstring --enable-mbregex --enable-bcmath --enable-calendar --with-zlib=/usr/local/opt/zlib --with-ldap --with-ldap-sasl=/usr --with-xmlrpc --with-kerberos=/usr --with-xsl=/usr --with-gd --enable-gd-native-ttf --with-freetype-dir=/usr/local/opt/freetype --with-jpeg-dir=/usr/local/opt/jpeg --with-png-dir=/usr/local/opt/libpng --with-gettext=/usr/local/opt
@wilr
wilr / EditableHiddenField.php
Last active December 20, 2015 22:18
EditableHiddenField for UserDefinedForms
<?php
/**
* @package userforms
*/
class EditableHiddenField extends EditableFormField {
private static $singular_name = 'Hidden Field';
private static $plural_name = 'Hidden Fields';
@wilr
wilr / dev.css
Last active December 19, 2015 15:58
Dev testing button style.
@-webkit-keyframes blinker {
from { color: #ff0; }
to { color: #fff; }
}
.devOnly {
color: #ff0 !important;
font-family: "Comic Sans",'Comic Sans MS', Textile, cursive !important;
outline: 2px solid purple !important;