Skip to content

Instantly share code, notes, and snippets.

View gustaflindqvist's full-sized avatar
🚴‍♂️
Focusing

Gustaf Lindqvist gustaflindqvist

🚴‍♂️
Focusing
View GitHub Profile
@gustaflindqvist
gustaflindqvist / sv.yml
Last active August 29, 2015 14:15 — forked from lindblom/sv.yml
# Det måste vara en tom rad här av någon anledning :)
sv:
date:
formats:
default: "%Y-%m-%d"
short: "%b %d"
long: "%B %d, %Y"
day_names: [Söndag, Måndag, Tisdag, Onsdag, Torsdag, Fredag, Lördag]
abbr_day_names: [Sön, Mån, Tis, Ons, Tors, Fre, Lör]

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@gustaflindqvist
gustaflindqvist / AppDelegate.swift
Created July 20, 2014 21:06
Possible solution
var appToken = "<YOUR-APP-TOKEN>"
Lookback.setupWithAppToken(appToken)
var lookback: Lookback = Lookback()
lookback.shakeToRecord = true;
class ActiveRecord::Base
def can_destroy?
self.class.reflect_on_all_associations.all? do |assoc|
assoc.options[:dependent] != :restrict || (assoc.macro == :has_one && self.send(assoc.name).nil?) || (assoc.macro == :has_many && self.send(assoc.name).empty?)
end
end
end
The value "device-width;" for key "width" is invalid, and has been ignored. alpint-stortlopp-traning-27963.html:8
The value "1.0;" for key "initial-scale" was truncated to its numeric prefix. alpint-stortlopp-traning-27963.html:8
The value "1.0;" for key "maximum-scale" was truncated to its numeric prefix. alpint-stortlopp-traning-27963.html:8
Error parsing a meta element's content: ';' is not a valid key-value pair separator. Please use ',' instead. alpint-stortlopp-traning-27963.html:8
Resource interpreted as Script but transferred with MIME type text/html: "http://os.viaplay.se/live/live.json?callback=D3PodiumLiveEvents&_=1391678355563". frameworks.js?20140126093037:207
body.scrollTop is deprecated in strict mode. Please use 'documentElement.scrollTop' if in strict mode and 'body.scrollTop' only if in quirks mode. page_context.js:225
body.scrollLeft is deprecated in strict mode. Please use 'documentElement.scrollLeft' if in strict mode and 'body.scrollLeft' only if in quirks mode. page_context.js:225
Uncau
# Install rvm system-wide
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )
# Update the packages
apt-get update
apt-get upgrade
apt-get install build-essential
# get the packages required by ruby
rvm pkg install zlib

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
$("#current_form").submit(function(e){
// prevent submit
e.preventDefault();
console.log($(this).serialize());
// to submit the form again
$(this).submit();
});
def check_ldap_user(name)
filter = Net::LDAP::Filter.eq("cn", name)
treebase = "dc=foo, dc=bar"
ldap.search(:base => treebase, :filter => filter, :attributes => attrs,
:return_result => false) do |entry|
entry.each do |attribute, values|
values.each do |value|
end
end