Skip to content

Instantly share code, notes, and snippets.

Avatar

David Strauß stravid

View GitHub Profile
@stravid
stravid / gist:10713318
Last active Aug 29, 2015
Fixtures in combination with Ember CLI. Read more about it here: http://edgycircle.com/blog/2014-using-fixtures-in-combination-with-ember-cli/
View gist:10713318
// The incorrect way of defining fixtures.
var Post = DS.Model.extend({
title: DS.attr('string'),
body: DS.attr('string')
});
Post.FIXTURES = [
{ id: 1, title: 'Title A', body: 'Body A' },
{ id: 2, title: 'Title B', body: 'Body B' }
];
@stravid
stravid / tractor.coffee
Last active Aug 29, 2015
Beispiel Traktor
View tractor.coffee
{
name_de: 'A 22'
start_of_production_de: 'ca. 10/1950'
tractor_number_de: 'ab ca. 5000'
number_of_produced_units_de: 'ca. 10.000'
technical_label_de: 'R 18'
wheelbase_de: '1500 mm'
length_de: '2580 mm'
chassis_clearance_de: '350 mm'
width_de: '1520 mm'
View gist:0606912e9bf4aa3ab23c
06:25 Grow your application organically, don't make it complicated upfront. (Rails works good for the things it was designed for.)
08:55 What if we had more logic?
10:30 Lets pretend we want to seprate it
11:30 Even it’s very small logic lets pretend there is more here
@stravid
stravid / shops.yml
Created May 19, 2014
Carrierwave + Fixtures
View shops.yml
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
ishophaircare:
name: ishophaircare
slug: ishophaircare
commission_level: 0
color: blue
custom_commission_rate: 0
sale: true
logo: <%= File.load("#{Rails.root}/test/fixtures/logo.png") %>
@stravid
stravid / 1.rb
Last active Aug 29, 2015
Invoice Push Update Application
View 1.rb
require 'sinatra'
require 'json'
current_invoice_id = 0
invoices = {}
before do
content_type :json
end
@stravid
stravid / number-to-currency-test.js
Created Jul 24, 2014
Testing Handlebars Helper with Ember CLI
View number-to-currency-test.js
import numberToCurrency from '../../helpers/number-to-currency';
module('number-to-currency Handlebars Helper');
test('convert invalid input to zero', function() {
equal('€ 0,00', numberToCurrency._rawFunction(null));
equal('€ 0,00', numberToCurrency._rawFunction(undefined));
});
test('handle single digit input', function() {
View servers.yml
---
- name: apply common configuration to all servers
hosts: all
remote_user: deployer
sudo_user: deployer
sudo: yes
vars:
- ansible_sudo_pass: secret
tasks:
- debug: msg={{ansible_sudo_pass}}
@stravid
stravid / Brocfile.js
Last active Aug 29, 2015
Creating a Datepicker Ember Addon
View Brocfile.js
// Rest of the file
app.import('bower_components/momentjs/moment.js');
app.import('bower_components/pikaday/pikaday.js');
app.import('bower_components/pikaday/css/pikaday.css');
module.exports = app.toTree();
View gist:f6e8c648df1284c82e94
require 'rubygems'
require 'bundler/setup'
require 'rom'
require 'rom-sql'
ROM.setup(:sql, 'postgres://localhost/datsu_development')
class Players < ROM::Relation[:sql]
register_as :players
dataset :players
View gist:d6d3a902016733e5e0d4
require 'rubygems'
require 'bundler/setup'
require 'rom'
require 'rom-sql'
ROM.setup(:sql, 'postgres://localhost/datsu_development')
class Players < ROM::Relation[:sql]
register_as :players
dataset :players
You can’t perform that action at this time.