Skip to content

Instantly share code, notes, and snippets.

View panayi's full-sized avatar

Panos Panagi panayi

  • Munich, Germany
  • 06:07 (UTC +02:00)
View GitHub Profile
@panayi
panayi / subscription_plan.rb
Created September 2, 2012 09:31 — forked from stympy/subscription_plan.rb
Extension to SubscriptionPlan provided in the SaaS Rails Kit
Rails.application.config.to_prepare do
SubscriptionPlan.class_eval do
scope :active, where(:active => true)
scope :by_price, order(:amount)
end
end
# This is an extension to ActiveMerchant to make the CIM gateway look a little more like the other gateways that
# support recurring billing. I wrote this code for the SaaS Rails Kit (http://railskits.com/saas), so if you are
# looking for a billing solution for your Rails application, feel free to check it out. :)
require 'digest/sha1'
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class AuthorizeNetCimGateway < Gateway
@panayi
panayi / router.js
Created September 11, 2012 08:13
Ember.js REST Rails-esque structure
App.Router. = Ember.Router.extend({
index: Ember.Route.extend({
route: '/posts',
connectOutlets: function(router) {
router.get('applicationController').connectOutlet('posts', App.Post.find());
}
}),
show: Ember.Route.extend({
routes: '/posts/:post_id',
require "rubygems"
require "nokogiri"
class PlainTextExtractor < Nokogiri::XML::SAX::Document
attr_reader :plaintext
# Initialize the state of interest variable with false
def initialize
@interesting = false
@panayi
panayi / ajax
Created January 17, 2013 14:38
console.log just before jquery.ajax
"{
"data": "{\"user\":{\"first_name\":\"asd\",\"last_name\":\"testchangeName\",\"email\":\"as@asd.com\",\"username\":null,\"have_reached_age_of_majority\":false,\"favourite_category_id\":null}}",
"context": {
"serializer": {
"mappings": {
"keys": {
"presenceSet": {
"ember417": true,
"ember418": true
},
@panayi
panayi / ember-data.js
Created April 20, 2013 08:31
Ember-Data revision 7
(function() {
window.DS = Ember.Namespace.create({
CURRENT_API_REVISION: 7
});
})();
(function() {
@panayi
panayi / ember-data-indexeddb-adapter.js
Created April 20, 2013 08:35
Ember-Data IndexedDB Adapter
(function() {
var get = Ember.get, set = Ember.set;
// This code initializes the IndexedDB database and defers Ember
// readiness until it gets a reference to an IDBDatabase.
Ember.onLoad('application', function(app) {
app.deferReadiness();
var indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB || window.msIndexedDB;
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@panayi
panayi / gist:6251177
Created August 16, 2013 16:05
npm list
panayi@machine:~/dropbox/Development/contractor/witsbits/webapp (master)$ npm list
npm WARN package.json fs-boot@0.0.9 'devDependences' should probably be 'devDependencies'
app@0.0.0 /Users/panayi/Dropbox/Development/contractor/witsbits/webapp
├─┬ grunt@0.4.1
│ ├── async@0.1.22
│ ├── coffee-script@1.3.3
│ ├── colors@0.6.1
│ ├── dateformat@1.0.2-1.2.3
│ ├── eventemitter2@0.4.12
│ ├─┬ findup-sync@0.1.2
@panayi
panayi / jsbin.ulesiwo.html
Created August 31, 2013 09:13
Continuous Redrawing of Ember.js Views
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Continuous Redrawing of Views" />
<script src="http://code.jquery.com/jquery.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.js"></script>
<script src="http://builds.emberjs.com/ember-latest.js"></script>
<meta charset=utf-8 />
<title>Continuous Redrawing of Views</title>
</head>