Skip to content

Instantly share code, notes, and snippets.

Avatar

Enrico Carlesso carlesso

View GitHub Profile
View cinepresa.rb
# :nocov:
if defined?(Rails)
module MyGem
module Rails
class Engine < ::Rails::Engine
end
end
end
end
# :nocov:
View npm-debug.log
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/bin/npm', 'start' ]
2 info using npm@2.12.1
3 info using node@v0.12.6
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart learning-react@1.0.0
6 info start learning-react@1.0.0
7 verbose unsafe-perm in lifecycle true
8 info learning-react@1.0.0 Failed to exec start script
9 verbose stack Error: learning-react@1.0.0 start: `node --harmony server`
View welcome_controller.rb
class WelcomeController < ApplicationController
def index
@xhr = request.xhr?
render :index, change: 'variable'
end
end
View client.rb
require 'rubygems'
require 'bundler/setup'
require 'faye/websocket'
require 'eventmachine'
require 'json'
require 'pry'
EM.run {
url = ARGV[0]
headers = {'Origin' => 'http://faye.jcoglan.com'}
@carlesso
carlesso / Twitter Languages - 2015-06-25
Created Jun 24, 2015
Twitter Languages - 2015-06-25
View Twitter Languages - 2015-06-25
[
{
"code": "fr",
"name": "French",
"status": "production"
},
{
"code": "en",
"name": "English",
"status": "production"
View match_serializer.rb
if object.asin.present?
"http://www.amazon.it/gp/product/#{object.asin}/ref=as_li_qf_br_asin_il_tl?ie=UTF8&camp=3370&creative=23322&creativeASIN=#{object.asin}&linkCode=as2&tag=swdaniele-21"
else
"http://www.amazon.it/s/ref=nb_sb_noss_1?__mk_it_IT=%C3%85M%C3%85%C5%BD%C3%95%C3%91&url=search-alias%3Ddvd&field-keywords=#{CGI::escape title}&tag=swdaniele-21"
end
View default.rb
%w{git bash-completion htop multitail sudo vim wget autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev}.each do |pkg|
puts "HERE: #{pkg}"
apt_package pkg
end
execute 'apt-get update' do
action :nothing
end.run_action(:run)
include_recipe 'basic::users'
View default.rb
%w{git bash-completion htop multitail sudo vim wget autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev}.each do |pkg|
package pkg do
action :install
end
end
execute 'apt-get update' do
action :nothing
end.run_action(:run)
@carlesso
carlesso / gist:e27b362e5b9bd8d69b3b
Created Feb 21, 2015
Pry show-method applied to .=~
View gist:e27b362e5b9bd8d69b3b
[16] pry(main)> show-method 'string'.=~
From: string.c (C Method):
Owner: String
Visibility: public
Number of lines: 14
static VALUE
rb_str_match(VALUE x, VALUE y)
{
@carlesso
carlesso / test.rb
Last active Aug 29, 2015
Ruby "somethingIdon'tknowhowtoname"?
View test.rb
class Something
key :foo
def do_foo_check
# I'd like to access key somehow here
put "I'm doing #{what}"
# Expecting I'm doing foo
end
key :foo