⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
🚴♂️
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# avoid path traversal attacks and speed up look-up | |
set :css_files, {} | |
Dir.glob("#{settings.public}/css/*.css") { |file| settings.css_files[File.basename(file, '.css')] = file } | |
get "/css/:name.css" do |name| | |
expires 60*60*24*356*3 | |
send_file setting.css_files[name] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Some good references are: | |
# http://russbrooks.com/2010/11/25/install-postgresql-9-on-os-x | |
# http://www.paolocorti.net/2008/01/30/installing-postgis-on-ubuntu/ | |
# http://postgis.refractions.net/documentation/manual-1.5/ch02.html#id2630392 | |
#1. Install PostgreSQL postgis and postgres | |
brew install postgis | |
initdb /usr/local/var/postgres | |
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Box Shadow</title> | |
<style> | |
.box { | |
height: 150px; | |
width: 300px; | |
margin: 20px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From the project root | |
rvm env -- `rvm current` >> .powenv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# take one of the wifi cards from the bar and fill in the blanks | |
# this wil log you into the hotel wifi without having to type in the username/password every time | |
curl -XPOST -d "username=<username>&password=<password>&operator=homerun.telia.com" https://login.homerun.telia.com/sd/login |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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] |
OlderNewer