Skip to content

Instantly share code, notes, and snippets.

View simon-engledew's full-sized avatar
🙈

Simon Engledew simon-engledew

🙈
View GitHub Profile
@simon-engledew
simon-engledew / process_lock.rb
Last active August 29, 2015 13:56
Set of useful methods for creating a singleton process
class ProcessLock
def initialize(filename)
FileUtils.touch(@filename = filename)
end
def acquire!
File.open(@filename, 'r+') do |f|
lock(f, false) do
f.truncate(f.write(Process.pid))
@simon-engledew
simon-engledew / cards.html
Created February 25, 2014 20:41
HTML5 Line Cards
<!DOCTYPE html>
<html>
<head>
<script src="http://zeptojs.com/zepto.js" type="text/javascript"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.2/raphael-min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/bacon.js/0.7.2/bacon.js" type="text/javascript"></script>
<style>
html, body {
height: 100%;
width: 100%;
@simon-engledew
simon-engledew / i18n_reverse.rb
Created April 17, 2014 11:46
Rails 3 i18n Progress Visualizer
# see how well you are doing localizing your site by flipping all localized text upside-down!
# anything being loaded from your en.yml will now be quite obvious!
if ENV['REVERSE']
module I18n::Backend::Base
def flip(c)
case c
when "a" then return "\u0250"
when "b" then return "q"
when "c" then return "\u0254"
@simon-engledew
simon-engledew / 1aTabOrder
Created February 3, 2015 12:11
Flibble Release v0.2.1 -A 2D game engine based on Flixel with glowing eyes.
Flibble Tab Order Version: 0.2.1
------------------------------
This file should not be included in the Codea project.
#Main
#FlbAnim
#FlbButton
#FlbCamera
#FlbController
#FlbEmitter
#FlbParticle
@simon-engledew
simon-engledew / tsung.xml
Created March 19, 2015 11:45
Tsung 1.5 + Rails Authenticity Token + URI encoding
<!-- You need to transform Val from a binary to a list and back again -->
<setdynvars sourcetype="eval" code="fun({Pid,DynVars})->
{ok, Val} = ts_dynvars:lookup(authenticity_token, DynVars),
list_to_binary(http_uri:encode(binary_to_list(Val)))
end.">
<var name="escaped_authenticity_token" />
</setdynvars>
@simon-engledew
simon-engledew / index.html
Created June 2, 2015 13:36
HTML5 Hexagons
<!DOCTYPE html>
<html>
<head>
<style>
* {
padding: 0;
margin: 0;
}
html, body {
height: 100%;
@simon-engledew
simon-engledew / worldmap.html
Last active August 29, 2015 14:22
World map with -webkit-clip-path
<!DOCTYPE html>
<html>
<head>
<style>
* {
padding: 0;
margin: 0;
}
html, body {
height: 100%;
@simon-engledew
simon-engledew / Gemfile
Created August 25, 2015 14:53
Building a stand-alone Jekyll for windows
source 'https://rubygems.org'
gem 'jekyll'
gem 'wdm', '>= 0.1.0'
gem 'hitimes', :platforms => :ruby # not sure if this works, had to install the pure ruby version manually (see build.sh)
font-family: -apple-system, ".SFNSText-Regular", "San Francisco", "Roboto", "Segoe UI", "Helvetica Neue", "Lucida Grande", sans-serif;
@simon-engledew
simon-engledew / gradients.less
Created October 30, 2015 16:05
Using spin to choose nice colours for gradients
// background-image: radial-gradient(circle at 50% 50%, spin(rgba(255,221,0,1), 0) 29%, spin(rgba(255,221,0,1), -16%) 120%);
background-image: radial-gradient(circle at 50% 50%, spin(rgba(0,116,217,1), -16%) 29%, spin(rgba(0,116,217,1), 0) 120%);