Skip to content

Instantly share code, notes, and snippets.

# Update, upgrade and install development tools:
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install build-essential git-core libssl-dev libsqlite3-dev curl nodejs nginx
# Install rvm
\curl -sSL https://get.rvm.io | bash -s stable
@twetzel
twetzel / activerecord.de.yml
Created September 3, 2014 10:27
example label translation including active-record and active-model attributes
de:
attributes: &activerecord_attributes
user: &users_labels
email: "E-Mail"
name: "Name"
first_name: "Vorname"
last_name: "Nachname"
remember_me: "Angemeldet bleiben"
user:
one: "Nutzer"
@twetzel
twetzel / page.css
Last active August 29, 2015 14:06
workaround to show nested translations for phraseapp on-page editor
.no_view_translation {
display: none; position: relative;
margin: 0; padding: 0;
}
body.tranlating_phrase .no_view_translation {
display: block;
width: auto; height: auto;
opacity: .5;
}
@twetzel
twetzel / some_controller.rb
Created September 3, 2014 11:37
pull phraseapp translations in controller action
# ..
def pull_translations
if system('phrase pull --format=yml')
I18n.backend.reload!
redirect_to :back, notice: "Pulled translations from PhraseApp! :)"
else
redirect_to :back, alert: "Couldn't pull translations from PhraseApp! :("
end
end
// config/environment.js
// This is not for production. But it will get your
// console to stop screaming errors if your messing
// around with ember cli
module.exports = function(environment) {
//lots of stuff
// <Add this chunk>
// for demo: http://jsbin.com/jeqesisa/7/edit
// for detailed comments, see my SO answer here http://stackoverflow.com/questions/8853396/logical-operator-in-a-handlebars-js-if-conditional/21915381#21915381
/* a helper to execute an IF statement with any expression
USAGE:
-- Yes you NEED to properly escape the string literals, or just alternate single and double quotes
-- to access any global function or property you should use window.functionName() instead of just functionName()
-- this example assumes you passed this context to your handlebars template( {name: 'Sam', age: '20' } ), notice age is a string, just for so I can demo parseInt later
<p>
{{#xif " this.name == 'Sam' && this.age === '12' " }}
@twetzel
twetzel / db.coffee
Last active September 5, 2015 21:39 — forked from jaigouk/db.coffee
Riot.js Todo MVC in coffeescript https://github.com/moot/riotjs
DB = (key) ->
store = window.localStorage
get: ->
JSON.parse store[key] or "{}"
put: (data) ->
store[key] = JSON.stringify(data)
@twetzel
twetzel / server_setup.md
Created June 17, 2012 15:42 — forked from erotte/server_setup.md
Server Setup Ubuntu 10.4/rvm/nginx/passenger Hosteurope VM

Server Setup

Unsere Setup-Routine für eine Rails-App mit Nginx, Passenger, rvm auf einen Host Europe-VPS mit Ubuntu 10.4.

Installation der benötigten Pakete

apt-get update

apt-get install -y build-essential bison openssl libreadline5 libreadline5-dev curl \

class App.Root extends Spine.Stack
controllers:
resources: App.Resources
users: App.Users
routes:
'/resources' : 'resources'
'/users' : 'users'
default: 'users'
@twetzel
twetzel / ajax_error.js.coffee
Created June 21, 2012 22:08
Handle spine ajax errors with jQuery .. by Ian White
Handle global ajax errors with jQuery:
$(document).ajaxError (xhr, status, error) =>
console.log("Global ajaxError", arguments)
if xhr.status is 403
window.location = "http://backend.myapp.com/login"
Handle individual jQuery ajax requests:
$.ajax(
url: url