Skip to content

Instantly share code, notes, and snippets.

View aledalgrande's full-sized avatar

Alessandro Dal Grande aledalgrande

View GitHub Profile
@aledalgrande
aledalgrande / Gemfile
Created August 9, 2014 00:17
Redis example
# Gemfile
gem 'redis', '~> 3.0.1'
gem 'hiredis', '~> 0.4.5'
@aledalgrande
aledalgrande / Gemfile
Last active August 29, 2015 14:05
Sidekiq video upload
# Gemfile
gem 'sidekiq'
@aledalgrande
aledalgrande / home_controller.rb
Created August 10, 2014 02:03
Sidekiq notification
# app/controllers/home_controller.rb
class HomeController < ApplicationController
def index
@news = News.get_recent
@notifications = current_user.notifications
end
end
@aledalgrande
aledalgrande / rotations.h
Last active August 29, 2015 14:06
Fast 90°, -90°, 180° rotations
// rotate 90° CW: flip the transpose on Y
inline void rotate90CW(cv::Mat& input)
{
cv::flip(input.t(), input, 1);
}
// rotate -90° CW: flip the transpose on X
inline void rotate90CCW(cv::Mat& input)
{
cv::flip(input.t(), input, 0);
ruby-1.9.1-p378 > tree = parser.parse "field :ciccio, 'integer'"
=> SyntaxNode+Field1+Field0 offset=0, "...d :ciccio, 'integer'" (construct,sp,name,s1,s2,interpretation):
SyntaxNode offset=0, "field"
SyntaxNode offset=5, " ":
SyntaxNode offset=5, " "
SyntaxNode offset=6, ":"
SyntaxNode offset=7, "ciccio":
SyntaxNode offset=7, "c"
SyntaxNode offset=8, "i"
SyntaxNode offset=9, "c"
ruby-1.9.1-p378 > tree = parser.parse "field :ciccio, 'integer'"
=> SyntaxNode+Field1+Field0 offset=0, "...d :ciccio, 'integer'" (construct,sp,name,s1,s2,interpretation):
SyntaxNode offset=0, "field"
SyntaxNode offset=5, " ":
SyntaxNode offset=5, " "
SyntaxNode offset=6, ":"
SyntaxNode offset=7, "ciccio":
SyntaxNode offset=7, "c"
SyntaxNode offset=8, "i"
SyntaxNode offset=9, "c"
%div.example
foo
:coffeescript
alert "I have #{@count} posts"
namespace :release do
task :js => :environment do
puts "Compiling coffeescript to javascript..."
[...]
File.open("#{release_dir}/example.js", 'w') do |file|
file.write CoffeeScript.compile(File.read("#{dev_dir}/example.coffee"))
end
puts "Coffeescript compiled"
puts "Closure Compiler: minifying"
test = (input) ->
alert input
test 'hello'
require 'usb'
require 'betabrite'
###
# Get a betabrite sign:
#
# http://www.betabrite.com/
# http://www.amazon.com/Brite-Prism-Moving-Message-Display/dp/B000MQAI72
#
# Install gems: