Skip to content

Instantly share code, notes, and snippets.

View pigoz's full-sized avatar
:octocat:

Stefano Pigozzi pigoz

:octocat:
View GitHub Profile
@pigoz
pigoz / gist:2027765
Created March 13, 2012 09:12
vagrant setup
vagrant up
vagrant ssh
sudo apt-get update
sudo apt-get upgrade
exit
vagrant reload
vagrant ssh
sudo apt-get install build-essential module-assistant linux-headers-$(uname -r) dkms
@pigoz
pigoz / gist:2225164
Created March 28, 2012 10:02
osx, gnu gettext, mplayer2
CC stream/tvi_dummy.o
CC sub/unrar_exec.o
CC stream/stream_vcd.o
CC libmpcodecs/vd_xanim.o
CC mplayer
Undefined symbols for architecture x86_64:
"_libintl_textdomain", referenced from:
_mp_msg_init in mp_msg.o
"_libintl_bindtextdomain", referenced from:
_mp_msg_init in mp_msg.o
From d468b63093500ff33562b1f0ca22ca646fe24c13 Mon Sep 17 00:00:00 2001
From: Stefano Pigozzi <stefano.pigozzi@gmail.com>
Date: Wed, 30 May 2012 16:27:22 +0200
Subject: [PATCH] lavu: fix compilation with Apple's llvm-gcc
Change DECLARE_ASM_CONST macro not to use the static qualifier,
preventing a linking failure when using the declared costant from a
function's scope.
In practice, this fixes the compilation of software like mplayer that
@pigoz
pigoz / gist:3169881
Created July 24, 2012 13:21
little idea
mapper = mappy do
map :name => :username
imap :status => :invalid do |status|
status == invalid
end
end
map1 = mapper.new User, Hash
map2 = mapper.new Hash, User
require 'rubygems'
require 'ripper'
require 'sorcerer'
require 'awesome_print'
def ident(name, pos=[0, 0])
[:@ident, name, pos]
end
def var_ref(name)
@pigoz
pigoz / app_helpers_application_helper.rb
Created August 6, 2012 17:24
composite-pattern-navigation menu
module ApplicationHelper
## ..snip
def build_taxon_subtree(root)
tree = Navigation::Tree("#{root.permalink}", root.name)
Spree::Taxon.where(:parent_id => root.id).all.each do |taxon|
count = Spree::Taxon.where(:parent_id => taxon.id).count
if count > 0
tree.add(build_taxon_subtree(taxon))
CheckLoginWithWS = ($http, $location, $rootScope) ->
if !$rootScope.current_user?
PerformLogin($http, $location, $rootScope)
else
$rootScope.$broadcast 'user'
PerformLogin = ($http, $location, $rootScope) ->
$http.get('/api/v1/customers/me.json')
.success (data) ->
if data.uid?
@pigoz
pigoz / gist:3476617
Created August 26, 2012 09:34
Build iOS Application for a Jailbroken device

Here are the steps I followed (Xcode 4.3 and iOS 5.1.1):

  • Create a self signed certificate from Keychain (the only that must be changed is the type of certificate which must be Code Signing, this is in the first form).

  • This is easily reverseable by restoring the .bak file or inverting the sed substitution:

    sudo /usr/bin/sed -i .bak 's/XCiPhoneOSCodeSignContext/XCCodeSignContext/' \
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Info.plist
    
@pigoz
pigoz / gist:3496410
Created August 28, 2012 09:09
getting started with Lift

Here's the steps:

  • brew install scala sbt
  • get the tar of the last stable release: https://github.com/lift/lift_24_sbt/tarball/master
  • copy over the project you want. I used scala_29/lift_xhtml
  • export MAVEN_OPTS="-Xms256m -Xmx1024m" in your .profile
  • sbt -> update (gets dependencies through maven) -> jetty-run (runs development webserver)
  • head over to http://0.0.0.0:8080
@pigoz
pigoz / play-experiments.md
Created September 4, 2012 09:39
really dumb installer for play 2.0.3

Installing Play

Run play-install.sh from any directory you want, this will automate the installation of play in any directory you want it. It is possibile to install through sbt by just setting up a sbt project with play as a dependency but you seem to loose the rails like magic for project generation and such (and I like magic).

Also play is in homebrew! Happy about that? Well, don't use it because it's broken! There is a bug in the play shell script launcher when play is invoked through symlinks. This is the ticket on their issue tracker: https://play.lighthouseapp.com/projects/82401/tickets/194-failure-on-getting-a-realpath-of-the-execution-file-play