Skip to content

Instantly share code, notes, and snippets.

View andreapavoni's full-sized avatar
🎧
❤️‍🔥🪩🕺🏻🚀

Andrea Pavoni andreapavoni

🎧
❤️‍🔥🪩🕺🏻🚀
View GitHub Profile
@andreapavoni
andreapavoni / gentoo-cloner.sh
Created December 4, 2014 10:02
Gentoo cloner: old utility to clone gentoo installation on twin machines
#!/bin/bash
# GentooCloner 0.5.1_alpha - clone your gentoo on identical/similar machines or just do a stage4 :)
AUTHOR="Copyright (c) 2006 Andrea Pavoni (http://andreapavoni.com)"
LICENSE="
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
@andreapavoni
andreapavoni / gulpfile.coffee
Created November 28, 2014 10:36
Gulp + browserify + coffeelint + bower + ...
gulp = require('gulp')
gutil = require('gulp-util')
browserify = require('gulp-browserify')
coffeelint = require('gulp-coffeelint')
rename = require('gulp-rename')
uglify = require('gulp-uglify')
size = require('gulp-size')
clean = require('gulp-rimraf')
# LOAD ENVs to use with envify
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Modify by linuz.ly
package main
import (
"bytes"
"fmt"
"code.google.com/p/go.crypto/ssh"

This is all based on the [alpha release][1].

Properties

From the built-in help system:

For many settings TextMate will look for a .tm_properties file in the current folder and in any parent folders (up to the user’s home folder).

These are simple setting = value listings where the value is a format string in which other variables can be referenced.

#commit model
class Commit < ActiveRecord::Base
# 1) We don't need a provider based Commit subclass, a String field
# should be enough. In case, we can associate a Provider model
# (1 to 1 relation) that represents a specific provider
# 2) we might want to use commit IDs, then build the commit URL at runtime
# (perhaps an URL template specific to the provider should be specified in Provider model)
# this shuould prevent eventual URL changes by providers :-)
attr_accessible :commit_url, :author, :commit_message, :provider
<!--
This code is a working example of the code shown in the 12devs[0]'s article:
"Rapid Prototyping with AngularJS"[1] by Tom Ashworth[2].
I put it here for reference ;-)
[0] http://12devs.co.uk
[1] http://12devs.co.uk/articles/rapid-prototyping-with-angularjs/
[2] http://twitter.com/phuunet
package main
import (
"code.google.com/p/go.net/websocket"
)
type connection struct {
// The websocket connection.
ws *websocket.Conn
# app/controllers/custom_devise/password_controller.rb
class CustomDevise::PasswordsController < Devise::PasswordsController
def resource_params
params.require(resource_name).permit(:email, :password, :password_confirmation)
end
private :resource_params
end
@andreapavoni
andreapavoni / jquery_plugin.coffee
Created March 1, 2013 14:17
A basic example to show how to implement simple/clean jQuery plugins with CoffeeScript
# jQuery custom plugin skeleton with CoffeeScript
class MyPlugin
someMethod: (args) ->
# do something
constructor: (element, params) ->
@someMethod(some_args)
# do something
# install in the window namespace
module SimpleStateMachine
extend ActiveSupport::Concern
# instance methods
included do
def current_step
# model that includes this module must have a field called 'current_step'
super || steps.first
end