Skip to content

Instantly share code, notes, and snippets.

David Ratajczak mockra

Block or report user

Report or block mockra

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View cron.rake
task :cron => [ :environment, :email ] do
end
task :email do
if Time.now.hour % 6 == 0
# Send Email
end
end
View ember.rake
namespace :ember do
task :update do
[['~/.ember', 'git://github.com/emberjs/ember.js.git', 'ember.js'],
['~/.ember-data', 'git://github.com/emberjs/data.git', 'ember-data.js']
].each { |i| EmberBuild.new(*i).update }
end
end
class EmberBuild
attr_reader :ember_dir, :repo, :file_name, :gem_file
View brand_topic.rb
def set_all args = {}
args.each do |key, value|
send "#{key}=", value
end
end
@mockra
mockra / array_diff.rb
Created Jun 21, 2013
Array Diff - find additions and deletions between arrays
View array_diff.rb
class ArrayDiff
attr_reader :one, :two
def initialize one, two
@one, @two = one.to_a, two.to_a
end
def deletions
one_dup = one.clone
two.each { |x| one_dup.slice!(one_dup.index(x)) if one_dup.index(x) }
View chart_js
var data = <%= @deck.stats.curve.to_json.html_safe %>;
var ctx = document.getElementById("curve").getContext("2d");
new Chart(ctx).Bar(data);
# Output from @deck.stats.curve
{:labels=>["1", "2", "3", "4", "5", "6", "7"],
:datasets=>[{:fillColor=>"rgba(220,220,220,0.5)",
:strokeColor=>"rgba(220,220,220,1)",
:data=>[11, 9, 5, 6, 1, 6, 3]}]}
View gist:7261186
# Install the Ruby library
gem install dnsimple-ruby
# Check if a domain is available
DNSimple::Domain.check(your_domain_name) == 'available'
# Register a domain
domain = DNSimple::Domain.register(domain_name)
# Apply a template to your domain
View brunch-config.coffee
exports.config =
# See http://brunch.io/#documentation for docs.
files:
javascripts:
joinTo: 'app.js': /^(app|vendor|bower_components)/
order:
before: [
'bower_components/jquery/jquery.js'
'bower_components/handlebars/handlebars.js'
'bower_components/ember/ember.js'
View initialize.js
window.App = Ember.Application.create();
require('store');
require('router');
var folderOrder = [ 'routes', 'models', 'views', 'controllers', 'helpers',
'templates', 'components' ];
folderOrder.forEach(function(folder) {
window.require.list().filter(function(module) {
View store.js
DS.RESTAdapter.reopen({
namespace: 'api/1',
serializer: DS.RESTSerializer.extend({
primaryKey: function(type) {
return '_id';
}
})
});
View router.js
App.Router.map(function() {
return this.resource('todos', {
path: '/'
}, function() {});
});
You can’t perform that action at this time.