Skip to content

Instantly share code, notes, and snippets.

View pavelnikolov's full-sized avatar
🌴
On vacation

Pavel Nikolov pavelnikolov

🌴
On vacation
View GitHub Profile
package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"time"
)
type Person struct {
controllers.controller('MainCtrl', function($scope, $location, Facebook, $rootScope, $http, $location, Upload, Auth, User, Question, Category, Serie, Record, Location, Popup, Process, Card, Question) {
$scope.$on('authLoaded', function() {
$scope.isExpert($scope.main.serieId);
$scope.isMember($scope.main.serieId);
});
$scope.loadAuth = function() {
Auth.load().success(function(data) {
$scope.main.user = data.user;
$scope.$broadcast("authLoaded");
module Spree
class OrderObserver < ActiveRecord::Observer
# Generic transition callback *after* the transition is performed
def after_transition(order, transition)
raise "after transtion"
end
def after_complete(order, transition)
raise "It works!!!"
end
@pavelnikolov
pavelnikolov / order_decorator.rb
Created August 1, 2013 06:33
Order decorator
module Spree
Order.class_eval do
state_machine.after_transition :to => :complete, :do => :add_subscription
def add_subscription(transition)
# add subscription here - the method is not being called after successfully paying the order. The order and the payment both have state "complete" in the DB
end
end
end
require 'test_helper'
class RemoteNetaxeptTest < Test::Unit::TestCase
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
def setup
@gateway = NetaxeptGateway.new(fixtures(:netaxept))
@amount = 100
@credit_card = credit_card('4925000000000004')
@pavelnikolov
pavelnikolov / rAF.js
Created December 9, 2012 23:05 — forked from re1ro/rAF.js
requestAnimationFrame polyfill
// requestAnimationFrame polyfill by @rma4ok
!function (window) {
var
equestAnimationFrame = 'equestAnimationFrame',
requestAnimationFrame = 'r' + equestAnimationFrame,
ancelAnimationFrame = 'ancelAnimationFrame',
cancelAnimationFrame = 'c' + ancelAnimationFrame,
expectedTime = 0,