Skip to content

Instantly share code, notes, and snippets.

@santiaago
santiaago / main.go
Created February 10, 2015 19:20
Testing HTTP caching in Go
package main
import (
"bytes"
"flag"
"image"
"image/color"
"image/draw"
"image/jpeg"
"log"
@squarism
squarism / swagger.md
Created January 23, 2015 23:00
Swagger Grape Weirdness

Imma turn this into a blog post soon but in the meantime wanted to give the Google index a hit on

  cannot load such file -- grape-swagger

The grape-swagger gem is forked right now (2015-01-23). If you simply follow the docs, you're going to get a require error.

In Gemfile, change gem "grape-swagger-rails" to this: gem "grape-swagger-rails", github: "BrandyMint/grape-swagger-rails"

@shawn42
shawn42 / demo_stage.rb
Created January 6, 2015 02:14
tween usage in gamebox
define_stage :demo do
requires :tween_manager
curtain_up do
@player = spawn :player, x: 10, y:30
tween = tween_manager.tween_properties @player, {x: 600, y:750}, 6_000, Tween::Sine::InOut
# tweens can be canceled if need be, or they will clean themselves up when finished
timer_manager.add_timer :foo, 3_000, false do
tween.cancel!
end
@shawn42
shawn42 / gamebox_fade.rb
Created January 3, 2015 23:05
fading text in gamebox
define_behavior :fades do
requires :director
setup do # |opts|
fade_out_time = 3_000
actor.has_attributes total_fade_time: fade_out_time, fade_time: fade_out_time
director.when :update do |time_ms, secs|
actor.fade_time -= time_ms
alpha = 255 * actor.fade_time / actor.total_fade_time
actor.remove if actor.fade_time <= 0
@eoinkelly
eoinkelly / postgres-upgrade-recipe.sh
Last active November 9, 2017 16:59
Upgrade Postgres to 9.4 using Homebrew on Mac OSX
#!/bin/bash
# This script can be used in "run & hope" mode or you can use it as a recipe to
# do things manually - you probably want the latter if you really care about
# the data in your databases.
# Happy hacking
# /Eoin/
# Tell bash to stop if something goes wrong
set -e
@joerixaop
joerixaop / README.md
Last active August 29, 2015 14:10 — forked from botandrose/README.md
@paulRbr
paulRbr / logstash.conf
Last active January 17, 2022 04:22 — forked from mudge/logstash.conf
Logstash configuration to parse Rails logs in a multi-process environment. Assume your logs are prepend by logtags as seen in the RLOGTAGS pattern.
input {
file {
type => "rails"
path => "/log/development.log"
tags => ["development"]
}
}
filter {
if [type] == "rails" {
@abn
abn / heredoc-dockerfile.snip
Last active October 5, 2023 17:43
Dockerfile alternatives for heredoc
#printf
RUN printf '#!/bin/bash\n\
echo hello world from line 1\n\
echo hello world from line 2'\
>> /tmp/hello
#echo
RUN echo -e '#!/bin/bash\n\
echo hello world from line 1\n\
echo hello world from line 2'\
@chastell
chastell / unindent.rb
Last active June 14, 2016 17:24 — forked from avdi/unindent.rb
TEXT = <<EOF
See, the interesting thing about this text
is that while it seems like the first line defines an indent
it's actually the last line which has the smallest indent
there are also some blank lines
both with and without extra spaces in them
and it just goes on and on