Skip to content

Instantly share code, notes, and snippets.

Michael Kessler netzpirat

Block or report user

Report or block netzpirat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View app.coffee
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 Dec 29, 2011
Listen to file changes with Guard
View fs_change.rb
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 Dec 19, 2011
Create promotion code per collection for Shopify
View gist:1497369
# 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 Sep 12, 2011 — forked from mikeolivieri/validation.js
Backbone Model Validation
View validation.js
_.extend(Backbone.Model.prototype, Backbone.Events, {
errors: [],
validate: function (attrs) {
//reset
this.errors = [];
var model = this;
@netzpirat
netzpirat / form_basic.coffee
Created Jun 23, 2011
Model based form validation and row editor for Ext JS 4
View form_basic.coffee
# 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 Jun 1, 2011 — forked from kossnocorp/USAGE.md
MacVim with Drawer compile manual
View USAGE.md

Clone & Build

curl https://gist.github.com/raw/970438/caff9a09ed2d223b1123a69ede17cb19ad352af9/build.sh | sh
@netzpirat
netzpirat / test.coffee
Created May 4, 2011
Return nothing from a CoffeeScript function
View test.coffee
# Everything is an Expression
->
greeting = 'Hi CoffeeScripter'
# Expect it's undefined
->
greeting = 'Hi CoffeeScripter'
return undefined
@netzpirat
netzpirat / embed.rb
Created Mar 29, 2011
ActiveRecord embedding
View embed.rb
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 Mar 3, 2011
The Sencha responder adds generic JSON response handling for the Ext JS framework.
View json_helper.rb
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 Dec 29, 2010
Testing apotomo widgets with RSpec
View widgets.rb
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
You can’t perform that action at this time.