Skip to content

Instantly share code, notes, and snippets.

View jeffAwesome's full-sized avatar

Jeff Richardson jeffAwesome

View GitHub Profile
# this is the show.controller file
@Arc.module "MapApp.Show", (Show, App, Backbone, Marionette, $, _) ->
# the show controller method is public so we can access it
Show.Controller =
init: () ->
@getZones()
showMap: (map_view)->
@jeffAwesome
jeffAwesome / gist:4eb2007576f8432bcbd8
Created December 29, 2014 21:08
Balanced Send Payment to Bank Account
def send_payment
encounter = Encounter.find(self.encounter_id)
office = Admin.find(encounter.office_id)
bank_account = Balanced::BankAccount.fetch(office.bank_uri)
begin
credit = bank_account.credit(
:amount => self.amount.to_i * 100,
:description => 'Payment For '+encounter.title
)
set_paid_status

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command

Open/Goto


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods

JavaScript Testing with Grunt, Mocha and Chai

In the following post I would like to introduce one way how you can setup your testing workflow for JavaScript development. The central components in the testing environment are Grunt, Mocha and Chai that I will cover from the introduction and installation of each component to the cooperation of all components for the execution of tests.

If you are already an experienced Grunt user and just look for the Gruntfile.js and the Mocha / Chai setup just skip the central components section and skip to the installing components part.

You can find the sample project with all code at GitHub on: https://github.com/maicki/sample-js-testing-grunt-mocha-chai

Central Components

@jeffAwesome
jeffAwesome / IIFE-example.js
Created May 25, 2015 02:43
Javascript Module Pattern
(function() {
// code
}());
// OR
(function() {
// code
})();
@jeffAwesome
jeffAwesome / js-module-pattern-ex-1.js
Last active August 29, 2015 14:21
Javascript Module Pattern
var IceIceBaby = (function(window, $, undefined) {
/*
For clarity when you see this being referenced, in this instance its referencing
a new object that was created when the new keyword was called. The new object
will have the init function and the stop function on it.
*/
var VanillaIce = function() {
class PaymentGateway
def initialize(customer, gatewayCustomer = Balanced::Customer)
@GatewayCustomer = gatewayCustomer
@customer = customer
end
def customer
#return @GatewayCustomer.find(@customer.customer_uri) if @customer.customer_uri
# if balanced customer doesn't already exist... lets make one
@jeffAwesome
jeffAwesome / helloWorld.cs
Last active September 27, 2015 03:51
Hello World c#
using System;
namespace HelloWorld
{
class Hello
{
static void Main()
{
Console.WriteLine("Hello World!");
// Keep the console window open in debug mode.
@jeffAwesome
jeffAwesome / helloworld.js
Created September 27, 2015 03:52
Hello world in js
(function() {
console.log('Hello World');
})();
@jeffAwesome
jeffAwesome / helloworld.rb
Created September 27, 2015 03:55
Hello World in ruby
module HelloWorld
def self.hello
puts 'Hello World'
end
end
require "./helloWorld"
helloWorld.hello()
# or