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
@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,
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 / 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
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
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");
package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"time"
)
type Person struct {
var crypto = require("crypto")
, util = require("util")
, express = require("express");
var s3 = {
access_key_id: "<access_key>"
, secret_key: "<your_secret_key>"
, bucket: "<your_bucket>"
, acl: "public-read"
, https: "false"
```json
{
"body": {
"client": {
"name": "keybase.io node.js client",
"version": "0.7.7"
},
"key": {
"fingerprint": "7bb5bcd34d17bd2e78dbd7cbe3b3dc6dea0b579b",
"host": "keybase.io",
@pavelnikolov
pavelnikolov / index.html
Created February 7, 2016 12:45 — forked from anonymous/index.html
JS Bin React + Redux todo app // source http://jsbin.com/qejizi
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="React + Redux todo app">
<script src="http://fb.me/react-0.14.3.js"></script>
<script src="http://fb.me/react-dom-0.14.3.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/redux/3.2.1/redux.js"></script>
<script src="https://wzrd.in/standalone/expect@latest"></script>
<script src="https://wzrd.in/standalone/deep-freeze@latest"></script>
<meta charset="utf-8">
@pavelnikolov
pavelnikolov / index.html
Created February 8, 2016 13:27 — forked from anonymous/index.html
JS Bin React + Redux todo app // source http://jsbin.com/qejizi
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="React + Redux todo app">
<script src="http://fb.me/react-with-addons-0.14.3.js"></script>
<script src="http://fb.me/react-dom-0.14.3.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/redux/3.2.1/redux.js"></script>
<script src="https://wzrd.in/standalone/expect@latest"></script>
<script src="https://wzrd.in/standalone/deep-freeze@latest"></script>
<meta charset="utf-8">