Skip to content

Instantly share code, notes, and snippets.

View mcollina's full-sized avatar

Matteo Collina mcollina

View GitHub Profile
@bradgessler
bradgessler / .rvmrc
Created July 29, 2011 01:40
rvmrc file that controls the version of Ruby, the Gemset, Rubygems, and Bundler. Use this if you want to control this stuff in your development workflow.
#!/usr/bin/env bash
# Bare minimum Gems that are needed to keep a Ruby development environment in sync. This assumes
# that you use bundler in your workflow to control the installation of all other gems. If you need
# to bump the bundler or rubygem version across your team, change that here, then run bundler and
# and keep going.
RVMRC=1.9.2@my_gem_set
RUBYGEM_VERSION="1.6.2"
BUNDLER_VERSION="1.0.15"
@ariera
ariera / README.markdown
Created August 7, 2011 16:23
Nestable, sortable and dragable categories

Nestable, sortable and dragable categories:

In the project I'm working on we wanted to have a Category model which we wanted to be nestable. But we also liked the user to have a draggable interface to manage and rearrange the order of his categories. So we chose awesome_nested_set for the model and jQuery.nestedSortable for the UI.

It took me some time to arrange things to work properly so I wanted to share my work in case it helps anybody.

Before beginning

you might want to take a look at a demo app

  1. go to: http://awesomenestedsortable.heroku.com/groups/
  2. click in show of any group
@potomak
potomak / git_colors.sh
Created September 21, 2011 12:54
Git colors
git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto
@mcollina
mcollina / country.json
Created November 8, 2011 21:56
SharpNodes Use Case 1 APIs
// GET /COUNTRY/[COUNTRY_NAME]
{
"opennet_filtering_data": {
"political": {"score": INT},
"social": {"score": INT},
"tools": {"score": INT},
"conflict_security" : {"score": INT}
},
"google_removal_requests": {
@tpryan
tpryan / ribbon.html
Last active April 11, 2024 00:21
Github Ribbon in CSS.
<!--
Copyright (c) 2012 Terrence Ryan
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following
conditions:
@thulstrup
thulstrup / compass-retina-sprites.scss
Created March 20, 2012 19:18
Using Compass to generate normal and retina sprite maps
$sprites: sprite-map("sprites/*.png");
$sprites-retina: sprite-map("sprites-retina/*.png");
@mixin sprite-background($name) {
background-image: sprite-url($sprites);
background-position: sprite-position($sprites, $name);
background-repeat: no-repeat;
display: block;
height: image-height(sprite-file($sprites, $name));
width: image-width(sprite-file($sprites, $name));
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@wycats
wycats / 0_app.rb
Created April 19, 2012 10:22
Example of using a simple future library for parallel HTTP requests
class TicketsController < ApplicationController
def show
tickets = params[:tickets].split(",")
ticket_data = tickets.map do |ticket|
parallel { Faraday.get("http://tickets.local/#{ticket}") }
end
render json: { tickets: ticket_data.map(&:result) }
end
@adamvr
adamvr / client_test.js
Last active September 25, 2022 04:13
Tests for mqtt.js against mosquitto
var mqtt = require('mqtt');
mqtt.createConnection(1883, 'localhost', function(err, client) {
if (err) {
console.dir(err);
return process.exit(-1);
}
var events = ['connack', 'puback', 'pubrec', 'pubcomp'];
for i in $HOME/local/*; do
[ -d $i/bin ] && PATH="${i}/bin:${PATH}"
[ -d $i/sbin ] && PATH="${i}/sbin:${PATH}"
[ -d $i/include ] && CPATH="${i}/include:${CPATH}"
[ -d $i/lib ] && LD_LIBRARY_PATH="${i}/lib:${LD_LIBRARY_PATH}"
[ -d $i/lib ] && LD_RUN_PATH="${i}/lib:${LD_RUN_PATH}"
# uncomment the following if you use macintosh
# [ -d $i/lib ] && DYLD_LIBRARY_PATH="${i}/lib:${DYLD_LIBRARY_PATH}"
[ -d $i/lib/pkgconfig ] && PKG_CONFIG_PATH="${i}/lib/pkgconfig:${PKG_CONFIG_PATH}"
[ -d $i/share/man ] && MANPATH="${i}/share/man:${MANPATH}"