This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dependency - Function.prototype.bind or underscore/lodash | |
app = angular.module 'someApp' | |
class @BaseCtrl | |
@register: (app, name) -> | |
name ?= @name || @toString().match(/function\s*(.*?)\(/)?[1] | |
app.controller name, @ | |
@inject: (args...) -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app = angular.module 'checkboxListApp' | |
app.directive 'checkboxList', -> | |
restrict: 'AE' | |
replace: true | |
scope: | |
list: '=' | |
model: '=ngModel' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# By Elad Ossadon | |
app = angular.module 'eo-keepratio' | |
SPACERS = | |
'1:1': "R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" | |
'16:10': "R0lGODlhEAAKAIAAAP///wAAACH5BAEAAAAALAAAAAAQAAoAAAILhI+py+0Po5y0rgIAOw==" | |
'16:9': "R0lGODlhEAAJAIAAAP///wAAACH5BAEAAAAALAAAAAAQAAkAAAIKhI+py+0Po5yUFQA7" | |
'4:3': "R0lGODlhBAADAIAAAP///wAAACH5BAEAAAAALAAAAAAEAAMAAAIDhI9WADs=" | |
'3:1': "R0lGODlhAwABAIAAAP///wAAACH5BAEAAAAALAAAAAADAAEAAAIChAsAOw==" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in spec_helper.rb | |
RSpec.configure do |config| | |
records = [] | |
config.before :suite do | |
Cequel::Record.descendants.each do |klass| | |
klass.after_create {|r| records << r } | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app = angular.module 'my-app', ['eo-cached-resource-action'] | |
app.factory 'Category', ($resource, cachedResourceAction) -> | |
Category = $resource "/categories/:id/:action", {id: '@id'}, { | |
query: { method: 'GET', cache: true, isArray: true } | |
} | |
Category.query = cachedResourceAction.wrapArrayAction(Category.query) | |
Category |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding : utf-8 -*- | |
require 'spec_helper' | |
require 'shared/versioning_examples' | |
describe Grape::API do | |
module EncodingSpec | |
class API < Grape::API | |
params do | |
requires :a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sass(path) { | |
var cssFilter = $.filter('**/*.css'); | |
return gulp.src(path, { base: 'app', dot: true }) | |
.pipe($.changed($.config.tmp, {extension: '.css'})) | |
.pipe($.plumber()) | |
.pipe($.rubySass({ | |
container: path.replace(/[\*\/]/g, "_") | |
})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# routes.rb (very bottom route): | |
match '*path' => SlugRackApp | |
# slug_rack_app.rb | |
class SlugRackApp | |
def self.call(env) | |
path = env["action_dispatch.request.path_parameters"][:path] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'), | |
httpProxy = require('http-proxy'); | |
var proxy = httpProxy.createProxyServer({}); | |
var server = http.createServer(function (req, res) { | |
console.log(req.url, req.method); | |
res.setHeader('Access-Control-Allow-Origin', '*'); | |
res.setHeader('Access-Control-Request-Method', '*'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pendingPromisesMap = () => { | |
const FN_INDEX = 0 | |
const KEY_INDEX = 1 | |
const VALUE_INDEX = 2 | |
const a = [] | |
function is(item, fn, key) { | |
if (item[FN_INDEX] == fn && item[KEY_INDEX] == key) { | |
return true |