Skip to content

Instantly share code, notes, and snippets.

View firegoby's full-sized avatar

Chris Batchelor firegoby

View GitHub Profile
@firegoby
firegoby / Cropper.jsx
Created September 3, 2015 15:01
Meteor React Jcrop Slingshot Semantic UI Component - User locally crops an image and uploads direct to S3 via Slingshot with upload progress
let stages = {
DISABLED: 'disabled',
ACTIVE: 'active',
SAVING: 'saving',
WARNING: 'warning',
ERROR: 'error',
SUCCESS: 'success'
}
let stage = new ReactiveVar(stages.DISABLED)
let uploader = new ReactiveVar(null)
@firegoby
firegoby / extension.driver.php
Created October 2, 2014 22:02
Timestamp parameter extension for Symphony CMS
<?php
Class extension_timestamp_parameter extends Extension {
public function install() {
}
public function uninstall() {
}
@firegoby
firegoby / walk.go
Created October 2, 2013 13:06
Solution to A Tour of Go Equivalent Binary Trees exercise - http://tour.golang.org/#70
package main
import (
"code.google.com/p/go-tour/tree"
"fmt"
)
// Walk walks the tree t sending all values
// from the tree to the channel ch.
func Walk(t *tree.Tree, ch chan int) {
@firegoby
firegoby / crawler.go
Created October 2, 2013 12:41
Solution to A Tour of Go final exercise - modify a web crawler to fetch URLs in parallel without fetching the same URL twice. Use Go's concurrency features. I used sync.WaitGroup to control the goroutines and a simple string->bool map to store already fetched URLs. Inline comments have further info
package main
import (
"fmt"
"sync"
)
type Fetcher interface {
// Fetch returns the body of URL and
// a slice of URLs found on that page.
@firegoby
firegoby / gist:6584781
Last active December 23, 2015 05:09
As a fallback for non-JS users simply place your best one-size-fits-all img tag inside a noscript tag inside the div. With JS switched off this behaves just like a normal img wrapped in a div
<div class="imager" data-src="/image/1/720/0/images/example.jpg" data-width="720">
<noscript>
<img src="/image/1/720/0/images/example.jpg" alt="my image"/>
</noscript>
</div>
@firegoby
firegoby / data.xml
Created September 11, 2013 19:50
Minimalist example for getting my fork of BBC News' Imager.js (https://github.com/firegoby/Imager.js) working with Symphony CMS
<images>
<file size="345 KB" path="/images" type="image/jpeg">
<filename>1z9x6l7.jpg</filename>
<meta creation="2013-09-11T13:39:53+01:00" width="2560" height="1440" />
</file>
<file size="367 KB" path="/images" type="image/jpeg">
<filename>adfp6hk.jpg</filename>
<meta creation="2013-09-11T13:40:30+01:00" width="1920" height="1280" />
</file>
<file size="4.15 MB" path="/images" type="image/jpeg">