Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Hoelbling-Inzko Tigraine

View GitHub Profile
View DesktopLauncher.java
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.title = "Thesis";
config.useGL30 = true;
config.height = 1280;
config.width = 768;
new LwjglApplication(new MyGdxGame(), config);
View exposeException.js
// 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;
View tmux.conf
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
Tomdoc on Ruby 1.8.7-p371 and 1.9.3-p194
View gist:5543977
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)
View gist:5356050
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
View ntp.sh
sudo ntpdate ntp.ubuntu.com
sudo apt-get install ntp
View gist:3313759
# 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 Aug 3, 2012
expiring cookie based sessions
View secret_token.rb
MyApp::Application.config.secret_token = '10dfec4781b682762a731a5e88af78521fc3e0f8f216fe7d4171d8222be3d4f469a175af41549660db6ac144dba807eb70779aff46f428d6d92e9e2fa6fa96b3'
View after.html.erb
<div>
<%= render :partial => 'grid_list', :locals => { :list => @hot_videos, :dont_paginate => true } %>
</div>
<div>
<%= render :partial => 'grid_list', :locals => { :list => @videos } %>
</div>
View migration.rb
@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
You can’t perform that action at this time.