Skip to content

Instantly share code, notes, and snippets.

View lusentis's full-sized avatar

Simone Lusenti lusentis

View GitHub Profile
routes = [
['/profile/', 'my_profile']
['/login/', 'login']
['/logout/', ['User', 'logout']]
['/upload/', 'show_upload']
['/docs/', 'my_docs']
]
define ['router', 'text!templates/document.html'], (routerjs, template_doc) ->
class Document extends routerjs.SyncModel
url: '/document/' # API end point
template: template_doc # HTML Template to render when fetching data with @get
Document.mine = (callback) ->
@req 'mine/', 'GET', {}, callback
@lusentis
lusentis / gist:3892003
Created October 15, 2012 11:20
Epson TM-T88 serial python
# -~- coding: utf-8 -~-
## not working write
import serial
import sys
import StringIO
def fp81_write(s, payload):
@lusentis
lusentis / grunt.js
Created October 20, 2012 15:46
Grunt min task with support for minification without concatenation (one-to-one)
//.....
min: { // for production
vendor: {
src: ['public/js/vendor/*.js'],
dest: 'public_build/js/vendor.js',
separator: ';'
},
app: {
src: ['public/js/*.js'],
destDir: 'public_build/js/',
@lusentis
lusentis / objectstorage.js
Last active October 12, 2015 04:08
Object storage support for HTML5 Storage
/*global Storage:false */
/*jshint eqnull:true */
/*
* Extends Storage object to support storing JSON-encoded objects.
* (c) 2012 PlasticPanda.com
* License: MIT
*/
(function (Storage) {
@lusentis
lusentis / .gitconfig
Created November 17, 2012 15:38
Git hooks and scripts for production deployment (Python only at the moment)
# add this line:
[receive]
denyCurrentBranch = warn
@lusentis
lusentis / rc.local
Created November 19, 2012 17:28
rc.local for autodeploy with user-data
BATTAHOME=/home/battaglia
ENVFILE=$BATTAHOME/env.sh
userdata=`curl http://169.254.169.254/2007-08-29/user-data`
repourl=`echo "$userdata" | head -n 1`
envurl=`echo "$userdata" | tail -n 1`
echo -e "\n===> Downloading env from $envurl"
wget "$envurl" -O $ENVFILE
#!/bin/bash
if [ "$(whoami)" != "root" ]
then
echo "Please run as root"
exit 1
fi
echo -en "Application name => "
@lusentis
lusentis / merge.sh
Last active October 21, 2015 17:58
cloudformation-mixins
#!/bin/bash
set -e
STAGE=$1
if [ ! "$STAGE" ]; then
echo "Usage: $0 <stage>"
exit 1
fi
@lusentis
lusentis / index.html
Last active December 11, 2015 18:39
CSS3 Rotate demo
<html>
<head>
<style type="text/css">
.box {
width: 200px;
height: 200px;
background-color: white;
border: 1px solid red;
position: absolute;
top: 100px;