Skip to content

Instantly share code, notes, and snippets.

View zampino's full-sized avatar

Andrea Amantini zampino

View GitHub Profile
@zampino
zampino / unicodedecodeerror
Created March 14, 2012 08:51
Plumi and collective.contentlicensing UnicodeDecodeError
Module ZPublisher.Publish, line 126, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module Products.Five.browser.metaconfigure, line 476, in __call__
Module Products.Five.browser.pagetemplatefile, line 125, in __call__
Module Products.Five.browser.pagetemplatefile, line 59, in __call__
Module zope.pagetemplate.pagetemplate, line 113, in pt_render
Module zope.tal.talinterpreter, line 271, in __call__
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 888, in do_useMacro
@zampino
zampino / .emacs
Created September 6, 2012 09:35
.emacs@mneme
(global-auto-revert-mode 1)
(menu-bar-mode -1)
(tool-bar-mode -1)
;; KEY BINDINGS
(scroll-bar-mode -1)
(add-to-list 'load-path "/home/andrea/dev/devolute/emacs-configs/niklas-.emacs.d/rails/")
(load "/home/andrea/dev/devolute/emacs-configs/niklas-.emacs.d/rails/rails.el")
(load "/home/andrea/.emacs.d/coffee-mode/coffee-mode.el")
(add-to-list 'load-path "/home/andrea/.emacs.d/")
(add-to-list 'load-path "/home/andrea/emacs/")
@zampino
zampino / git-config@mneme
Last active October 13, 2015 01:27
git config --global @mneme
# git config --global --list
user.name=Andrea Amantini
user.email=andrea@devolute.org
color.ui=true
github.user=zampino
core.editor=emacs
core.excludesfile=/home/andrea/.gitignore
alias.co=checkout
alias.a=add
alias.s=status
@zampino
zampino / .emacs@mneme
Last active October 13, 2015 01:27
emcs main config @mneme
(global-auto-revert-mode 1)
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
(global-linum-mode t)
;; KEY BINDINGS
(global-set-key [s-right] 'next-multiframe-window)
(global-set-key [s-left] 'previous-multiframe-window)
(global-set-key (kbd "s-o") 'find-file)
(global-set-key (kbd "s-n") 'new-frame)
@zampino
zampino / .bash_profile
Last active December 9, 2015 18:18
bash profile ml
source ~/.bash_colors
######### GIT #######################
source /usr/local/git/contrib/completion/git-prompt.sh
source /usr/local/git/contrib/completion/git-completion.bash
GIT_PS1_SHOWDIRTYSTATE=true
# GIT_PS1_SHOWUPSTREAM=true
GIT_PS1_SHOWUNTRACKEDFILES=true
GIT_PS1_SHOWSTASHSTATE=true
export PS1='\[$COLOR_YELLOW\]\u@\h:\[$COLOR_MAGENTA\]\w\[$COLOR_LIGHTCYAN\]$(__git_ps1) \[$COLOR_RESET\]'
@zampino
zampino / struct_draft.rb
Created December 17, 2012 10:12
struct draft
require 'active_support/core_ext'
require 'ostruct'
# require 'debugger'
module Factory
PRIMARY_KEY_NAME = "name"
def self.build(node, content, options={})
Factory.for(node, content, options).produce
node
# from https://github.com/tomz/liblinear-ruby-swig/blob/master/ext/extconf.rb
require 'mkmf'
CONFIG["LDSHARED"] = case RUBY_PLATFORM
when /darwin/
"g++ -dynamic -bundle -undefined suppress -flat_namespace"
else
"g++ -shared"
end
$CFLAGS = "#{ENV['CFLAGS']} -Wall -O3 "
@zampino
zampino / exposures.rb
Created March 28, 2013 19:07
Grape with Exposures
require 'ostruct'
require 'grape-entity'
require 'active_support/concern'
module Exposable
extend ActiveSupport::Concern
# included do
# base = self
# end
# Node A:
# iex --sname "nodea"
Process.register self, :iex
# Blocking
receive do
{ :hello, pid } ->
IO.puts "Hello from #{inspect(pid)}"
end
@zampino
zampino / refinements_spec.rb
Last active January 2, 2016 17:39
Minimal example about ruby 2.1.0 refinements
module MyRefinements
refine Object do
def nice_name
"wow I am a #{self.class}"
end
end
refine Hash do
def foo
"foo"