Skip to content

Instantly share code, notes, and snippets.

View Tigraine's full-sized avatar

Daniel Hoelbling-Inzko Tigraine

View GitHub Profile
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.title = "Thesis";
config.useGL30 = true;
config.height = 1280;
config.width = 768;
new LwjglApplication(new MyGdxGame(), config);
// If you are faced with a stupid library swallowing callback exceptions this
// function will still report the exception details to you.
function exposeException(fn) {
return function () {
try {
return fn.apply(this, arguments);
} catch (e) {
console.log("Exception occured", e);
throw e;
set-option -g default-shell /usr/local/bin/zsh
set -g prefix C-a
bind-key C-a last-window
bind-key v split-window -v
setw -g monitor-activity on
set-window-option -g window-status-current-bg white
setw -g mode-keys vi
set -g mode-mouse on
set-window-option -g utf8 on
@Tigraine
Tigraine / gist:5543977
Created May 8, 2013 21:56
Tomdoc on Ruby 1.8.7-p371 and 1.9.3-p194
daniel@tigraine in ~
o tomdoc -v
TomDoc v0.2.5
daniel@tigraine in ~
o gem unpack tomdoc
Unpacked gem: '/home/daniel/tomdoc-0.2.5'
daniel@tigraine in ~
o tomdoc tomdoc-0.2.5/lib/tomdoc/source_parser.rb
--------------------------------------------------------------------------------
TomDoc::SourceParser.parse(text)
@Tigraine
Tigraine / gist:5356050
Last active December 16, 2015 01:30 — forked from ansix/gist:5356037
class Festival < ActiveRecord::Base
attr_accessible :name, :client_id
belongs_to :client
has_many :covers
has_many :photos
def self.with_covers
where("covers_count > 0") # or some other SQL with a COUNT and group maybe that filters correctly
sudo ntpdate ntp.ubuntu.com
sudo apt-get install ntp
# Basic tagging system for mongoid documents.
# jpemberthy 2010
#
# class User
# include Mongoid::Document
# include Mongoid::Document::Taggable
# end
#
# @user = User.new(:name => "Bobby")
# @user.tag_list = "awesome, slick, hefty"
@Tigraine
Tigraine / secret_token.rb
Created August 3, 2012 09:20
expiring cookie based sessions
MyApp::Application.config.secret_token = '10dfec4781b682762a731a5e88af78521fc3e0f8f216fe7d4171d8222be3d4f469a175af41549660db6ac144dba807eb70779aff46f428d6d92e9e2fa6fa96b3'
@Tigraine
Tigraine / after.html.erb
Created July 11, 2012 12:34
pagination locals
<div>
<%= render :partial => 'grid_list', :locals => { :list => @hot_videos, :dont_paginate => true } %>
</div>
<div>
<%= render :partial => 'grid_list', :locals => { :list => @videos } %>
</div>
@Tigraine
Tigraine / migration.rb
Created June 25, 2012 11:39
Persons Demo
@person = Person.first # a Person
link_to @person.name, @person # => /persons/1
@student = Student.first # a Student
link_to @student.name, @student # => /students/2
# this allows stuff like this:
@persons = Person.all # Person.all also includes Students
# @persons will look like this: [Person, Student, ..]
@persons.each do |p|
link_to p.name, p