Skip to content

Instantly share code, notes, and snippets.

View netzpirat's full-sized avatar

Michael Kessler netzpirat

View GitHub Profile
angular.module('project', ['projectServices'])
.config ($routeProvider) ->
$routeProvider
.when('/login',
templateUrl: 'partials/login.html',
controller: LoginCtrl)
.when('/assignments',
templateUrl: 'partials/assignments.html',
controller: AssignmentListCtrl)
.otherwise(redirectTo: '/login')
@netzpirat
netzpirat / fs_change.rb
Created December 29, 2011 09:37
Listen to file changes with Guard
require 'guard/listener'
listener = Guard::Listener.select_and_init({
watchdir: '/tmp',
watch_all_modifications: true
})
listener.on_change do |files|
puts "File change: #{ files.join(',') }"
end
@netzpirat
netzpirat / gist:1497369
Created December 19, 2011 14:03
Create promotion code per collection for Shopify
# Save your promotion codes in code.csv
require 'capybara'
require 'csv'
session = Capybara::Session.new(:selenium)
session.visit 'https://YOURSHOP.myshopify.com/admin/auth/login'
session.fill_in 'login', :with => 'YOURLOGIN'
session.fill_in 'password', :with => 'YOURPASSWORD'
session.click_button 'Sign In'
@netzpirat
netzpirat / validation.js
Created September 12, 2011 22:25 — forked from mikeolivieri/validation.js
Backbone Model Validation
_.extend(Backbone.Model.prototype, Backbone.Events, {
errors: [],
validate: function (attrs) {
//reset
this.errors = [];
var model = this;
@netzpirat
netzpirat / form_basic.coffee
Created June 23, 2011 23:15
Model based form validation and row editor for Ext JS 4
# The form adds model based validation to the form
# and it updates the 'reset' and 'save' buttons from the owning
# form panel according to the dirty and validity status of the form.
#
# @author Michael Kessler
#
Ext.define 'Ext.ux.form.Basic',
extend: 'Ext.form.Basic'
config:
@netzpirat
netzpirat / USAGE.md
Created June 1, 2011 08:39 — forked from kossnocorp/USAGE.md
MacVim with Drawer compile manual

Clone & Build

curl https://gist.github.com/raw/970438/caff9a09ed2d223b1123a69ede17cb19ad352af9/build.sh | sh
@netzpirat
netzpirat / test.coffee
Created May 4, 2011 19:34
Return nothing from a CoffeeScript function
# Everything is an Expression
->
greeting = 'Hi CoffeeScripter'
# Expect it's undefined
->
greeting = 'Hi CoffeeScripter'
return undefined
@netzpirat
netzpirat / embed.rb
Created March 29, 2011 14:12
ActiveRecord embedding
module ActiveRecord
# Allows embedding of ActiveRecord models.
#
# Embedding other ActiveRecord models is a composition of the two
# and leads to the following behaviour:
#
# - Nested attributes are accepted on the parent without the _attributes suffix
# - Mass assignment security allows the embedded attributes
# - Embedded models are destroyed with the parent when not appearing in an update again
@netzpirat
netzpirat / json_helper.rb
Created March 3, 2011 21:48
The Sencha responder adds generic JSON response handling for the Ext JS framework.
require 'siren'
# The JsonHelper adds a possibility to query JSON data with a simple query language.
# Read more about the Siren JSONQuery implementation at: https://github.com/jcoglan/siren
#
# @author Michael Kessler
#
module JsonHelper
def json(query)
@netzpirat
netzpirat / widgets.rb
Created December 29, 2010 13:36
Testing apotomo widgets with RSpec
module RSpec::Rails
module WidgetExampleGroup
extend ActiveSupport::Concern
extend RSpec::Rails::ModuleInclusion
include RSpec::Rails::RailsExampleGroup
include ActionView::TestCase::Behavior
include RSpec::Rails::ViewAssigns
include RSpec::Rails::Matchers::RenderTemplate
include RSpec::Rails::BrowserSimulators