Skip to content

Instantly share code, notes, and snippets.

👨‍💻

jacopo intrip

👨‍💻
Block or report user

Report or block intrip

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 dequeue_performance.rb
class Node
attr_accessor :value, :next_node, :prev_node
def initialize(value, next_node = nil, prev_node = nil)
@value = value
@next_node = next_node
@prev_node = prev_node
end
end
View to_utf8.rb
data = []
0.upto(2**(8*2)) do |i|
char = [i].pack("U*")
#puts "%04x" % i + ": " + char
data << char
end
p data, data.length
@intrip
intrip / sort_deprecation_warning_uniq.sh
Created Jul 5, 2017
rails sort deprecation warnings uniq
View sort_deprecation_warning_uniq.sh
ag 'DEPRECATION' log/development.log | awk -F 'DEPRECATION WARNING' '{print $2}' | sort -u
View tail_call_optimization.rb
# Base factorial version not tail recursive
def fact(n)
return 1 if n <= 1
n * fact(n-1)
end
# enable tail recursive optimization
RubyVM::InstructionSequence.compile_option = {
tailcall_optimization: true,
trace_instruction: false
@intrip
intrip / .vimrc
Last active Mar 14, 2017
Custom .vimrc for ruby and javascript development
View .vimrc
""""""""""""""""""
" Vundle options
"""""""""""""""""
set nocompatible " be iMproved, required
filetype off " required
:let mapleader = "-" " Maps - as leader character
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
@intrip
intrip / fake_cfs.rb
Created Oct 18, 2016
Italian fiscal code generator for Ruby on Rails
View fake_cfs.rb
module Italian
# Generates a random fiscal code
class << self
@@generated_cfs = []
def cf
res = []
# ^[A-Z]{6}
res << _A_Z(6)
View how to count 404 access on a server
grep " 404 " * | cut -d " " -f 7 | sort | uniq -c | sort -n -r | head -50 | less
On hhtpd access log directory
You can’t perform that action at this time.