Skip to content

Instantly share code, notes, and snippets.

View jgorset's full-sized avatar

Johannes Gorset jgorset

View GitHub Profile
@jgorset
jgorset / gist:1747655
Created February 5, 2012 19:41
How Sprockets works with JST and EJS templates
// This document distills the magic that happens when you create a file with the ".jst"
// and ".ejs" extensions anywhere on your asset path in Ruby on Rails, courtesy of the
// Sprockets library (https://github.com/sstephenson/sprockets).
//
// For the purpose of this example, imagine that you have created a template for
// messages in `app/assets/javascripts/backbone/templates/messages/message.jst.ejs`
// with the following contents:
//
// <h1><%= user.full_name %></h1>
// <p><%= body %></p>

Developers, developers, developers!

We are always looking for more developers to join our web, iOS and Android teams. If you’re passionate about building things, we’d really like to talk to you!

Us

We’re a team of twenty keen-witted engineers who do all kinds of things on all kinds of platforms. Right now our favourites are Ruby, JavaScript, Swift and Java, but we’re always excited to try new tools. Really we’re pretty excited about mostly anything that

@jgorset
jgorset / heroku-apps-with-gem.md
Last active April 19, 2016 19:28
Find all Heroku apps with a given gem
# heroku-apps-with-gem.sh
apps=$(heroku apps | grep -E -v '(^===|^$)' | awk '{print $1}')

set -k

for app in $apps; do
  heroku run "cat Gemfile.lock | grep $1" -a $app --exit-code > /dev/null 2>&1

 if (( $? == 0)); then
Stockpile.on :tweet do |tweet|
Tweet.new message: tweet.message
end
foo(); // Logs "foo".
function foo() { console.log("foo") }
foo(); // Raises "ReferenceError: foo is not defined".
foo = function() { console.log("foo") }
foo(); // Raises "TypeError: undefined is not a function".
var foo = function() { console.log("foo") }
I'm testing gist-vim. It's pretty awesome. I think. Yes.
@jgorset
jgorset / gist:4237588
Created December 7, 2012 23:47
Rooms...
# Load all rooms.
#
# Returns an array of hashes describing each room.
def all
devices = Device.all
rooms = []
# Go through each device, check wich room it belongs
# do, if the room does not exist, add it to rooms, if
# just add this device to the list of devices
@jgorset
jgorset / gist:3378321
Created August 17, 2012 12:01
Side-by-side comparison of template tags in Django and Ruby on Rails

Side-by-side comparison of template tags in Django and Ruby on Rails

Format the current time

Django

from django import template
import datetime
# encoding: utf-8
from httplib import HTTPConnection
from base64 import b64encode
from xml.etree import ElementTree
from django.conf import settings
class GateBackend:
"""Aspiro Gate Backend."""
class Call(models.Model):
call_at = models.DateTimeField()
contestant = models.OneToOneField(Contestant)
confirmed = models.BooleanField()
def confirm(self):
self.confirmed = True
self.save()
def save(self, *args, **kwargs):