Skip to content

Instantly share code, notes, and snippets.

View denisdefreyne's full-sized avatar

Denis Defreyne denisdefreyne

View GitHub Profile
function love.load()
love.graphics.setBackgroundColor(203, 232, 247)
end
function love.update(dt)
end
function love.draw()
love.graphics.setColor(255, 0, 0, 255)
love.graphics.setColor(168, 89, 8, 255)
-- config
local config = {
-- how much bigger/smaller the bucket should be than the default
-- smaller == faster but less accurate
bucketSizeFactor = 1 / 10.0,
-- how many surrounding buckets to consider when distributing
-- smaller == faster but less accurate
bucketSearchDistance = 2,
# encoding: utf-8
Bundler.require
require 'set'
require 'parser/current'
module NanocX
#############################################################################
@denisdefreyne
denisdefreyne / mustache_plus_nanoc.md
Last active December 30, 2015 06:29
Mustache + nanoc requirements

Goal: excellent Mustache support in nanoc

Need alternatives for:

  • <%= item[:blah] %>{{ item:blah }}
  • <%= item.path %>{{ item.path }}
  • <%= layout[:blah] %>{{ layout:blah }}
  • <%= config[:blah] %>{{ config:blah }}
  • <%= some_helper(…) %> → ???
  • &lt;% some_helper(…) do %&gt;…&lt;% end %&gt; → ???

SAFAC (Simple Audio File Alarm Clock)

On friday, January 31st, I arrived in Brussels and accidentally locked myself out of my phone by entering three wrong PINs. Because I could not eject the SIM card to use my phone in a SIM-less mode, I could no longer set an alarm, and had to improvise.

I ended up writing this script to wake me up by playing specific audio files at a specific time.

@denisdefreyne
denisdefreyne / nanoc.yaml
Created February 17, 2014 07:59
Overriding behaviors in filesystem_unified
data_sources:
-
type: filesystem_unified
overrides:
-
glob: content/assets/jquery/**/*
include_extension: true
binary: true
@denisdefreyne
denisdefreyne / nanoc-asciidoctor-preprocessor.rb
Created February 17, 2014 20:52
Preprocessor that extract AsciiDoc (Asciidoctor) metadata
preprocess do
@items.each do |item|
case item[:extension]
when 'adoc', 'asciidoc'
Asciidoctor::Document.new(item.raw_content).attributes.each_pair do |k,v|
item[k.to_sym] = v
end
end
end
end
@denisdefreyne
denisdefreyne / image_link.rb
Last active August 29, 2015 13:56
Linking to an image and extracting dimensions
@denisdefreyne
denisdefreyne / cheat-sheet.lua
Last active August 29, 2015 14:01
CoderDojo Berlin cheat sheet
-- variables
distance = 370.52
-- objects (tables)
hero = {
strength = 7,
dexterity = 8,
endurance = 6,
@denisdefreyne
denisdefreyne / sinatra-override-404.rb
Created June 3, 2014 11:39
Overriding Sinatra’s 404
require 'sinatra'
not_found do
'We do not have that kind of animal here sorreh'
end
get '/donkey' do
halt 404, 'We do not have a donkey.'
end