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
'use strict'; | |
angular.module('rallyApp') | |
.service('EventQueue', function EventQueue($q) { | |
var eventQueues = {}; | |
var listeners = {}; | |
var triggerEvent = function(queue, event, listener) { | |
queue.splice(queue.indexOf(event), 1); | |
listener.cb(event); |
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
Article.prototype.comments = function() { | |
var url = RouteIndex.comments($scope.article.id).relative(); | |
var deferred = $q.defer(); | |
$http.get(url).success(function(comments) { | |
deferred.resolve(comments); | |
}); | |
return deferred.promise; | |
}; | |
//usage |
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
@import "bourbon"; | |
@import "neat"; | |
@import "mixins"; | |
html, body { | |
font-family: $font-proxima-nova; | |
font-size: $fs-root; | |
} | |
input, select, textarea { |
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
# Share constants between ruby and javascript | |
# Setup | |
# (in application.html.erb, or some place to inject javascript) | |
# MyApplication.constants = #{CommonConstants.to_json}; | |
# | |
# Usage | |
# Ruby | |
# CommonConstants << "Math::PI" | |
# Javascript | |
# MyApplication.constants.MATH_PI |
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
module FailClassInference | |
def fail(*args) | |
return super unless args.first.is_a?(String) | |
super(infer_exception_class, *args) | |
end | |
def raise(*args) | |
return super unless args.first.is_a?(String) | |
super(infer_exception_class, *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
class Null | |
def !@ | |
false | |
end | |
def nil? | |
true | |
end | |
def present? |
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
# config/initializers/sprockets.rb | |
module Sprockets::Helpers::RailsHelper | |
def view_renderer | |
@view_renderer ||= begin | |
view_paths = Rails::Application::Configuration.new(Rails.root).paths["app/views"] | |
ActionView::Base.new(view_paths).tap do |renderer| | |
def renderer.method_missing(name, *args) | |
router = Rails.application.routes.url_helpers | |
return router.send(name, *args) if router.respond_to?(name) |
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 ConsoleLogOld = console.log; | |
undefined | |
> console.log = function() { | |
... ConsoleLogOld.apply(null, Array.prototype.slice.apply(arguments)) | |
... console.trace() | |
... } | |
[Function] | |
> console.log("meow") | |
/* | |
meow |
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
root@tara:~/tmp/1008583# locate images_controller.rb | |
/usr/lib/ruby/gems/1.8/gems/refinerycms-images-0.9.9.21/app/controllers/admin/images_controller.rb | |
root@tara:~/tmp/1008583# vim `locate images_controller.rb` |
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
<?php | |
/** | |
* A really simple memcache implementation for PHP - Based on https://gist.github.com/949850 | |
* Run the script, it listens on port 8000 | |
* To store a value, http://localhost:8000/write/family/key/val | |
* To read a value , http://localhost:8000/read/family/key | |
* | |
* This is just a proof of concept .. it doesn't handle errors etc.. | |
* |
OlderNewer