Skip to content

Instantly share code, notes, and snippets.

View piscis's full-sized avatar
🧱
¯\_(ツ)_/¯

Alex piscis

🧱
¯\_(ツ)_/¯
View GitHub Profile
@piscis
piscis / SassMeister-input.sass
Created March 6, 2014 10:06
Generated by SassMeister.com.
// ----
// Sass (v3.2.14)
// Compass (v0.12.2)
// ----
@import "compass"
.foobar
+scale(1)
+opacity(0)
@piscis
piscis / css
Last active August 29, 2015 13:57
Compare SASS/SCSS/CSS base syntax
.block-content img.img-thumbnail {
width: 35%;
}
.block-content img.img-thumbnail.pull-left {
margin-right: 8px;
}
.block-content img.img-thumbnail.pull-rigth {
margin-left: 8px;
}
@piscis
piscis / gist:7384954
Created November 9, 2013 12:30
Setup Ubuntu KVM VM with vmbuilder
vmbuilder kvm ubuntu -v \
--suite=precise \
--libvirt=qemu:///system \
--arch=amd64 --cpus=2 --mem=4024 --swapsize=4096 --rootsize=1204800 \
--flavour=virtual \
--hostname=XXXX \
--ip=XXX.XXX.XXX.XXX \
--mask=XXX.XXX.XXX.XXX \
--net=XXX.XXX.XXX.XXX \
--bcast=XXX.XXX.XXX.XXX \
@piscis
piscis / gist:5394829
Last active December 16, 2015 06:58
bind piler compat with express 3.x socket.io
// Install: express 3.x, socket.io 0.9.x, piler-compat
var express = require('express');
var app = express();
var piler = require('piler-compat');
var http = require('http');
var socketio = require('socket.io');
// Express
app.configure(function(){
//... express config
@piscis
piscis / server.js
Last active December 15, 2015 19:28
Copy&Paste static file server with nodejs
/**
* Create a static file server
* requires: node-static
* example: npm install node-static
*/
var conf = {
port: 8080,
address: "0.0.0.0",
pubDir: __dirname,
options: {
@piscis
piscis / Find all versions of a formula
Last active December 15, 2015 12:49
Find all available versions of a homebrew formula and resove "fatal: '/usr/local/Library/Formula/XXX.rb' is outside repository" error
# Allways a good idea to sync with the formular repository first
alex$ brew update
# List available version
alex$ brew versions zmq
3.2.2 git checkout ab8de4b /usr/local/Library/Formula/zeromq.rb
2.2.0 git checkout 6a2e6ef /usr/local/Library/Formula/zeromq.rb
2.1.11 git checkout 497b13a /usr/local/Library/Formula/zeromq.rb
2.1.10 git checkout 4c8ed3a /usr/local/Library/Formula/zeromq.rb
2.1.9 git checkout 381c97f /usr/local/Library/Formula/zeromq.rb
@piscis
piscis / iptables_rules.sh
Created February 26, 2013 14:41
Its a start :-)
# Allow outgoing traffic and disallow any passthroughs
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP
# Allow traffic already established to continue
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow ssh, web services
iptables -A INPUT -p tcp --dport ssh -j ACCEPT
@piscis
piscis / gist:4705921
Last active December 12, 2015 03:18
Power to the closures!
var a = []; for(var i=1; i<=100;i++) a.push((i*1));
var stopWordAnalyzer = function(list){
return function(stopword){
var fizzCount = 0;
list.forEach(function(y){ if(stopword==y){fizzCount++;}});
console.log('There are: '+fizzCount+' '+stopword+' in 1..100');
}
}
@piscis
piscis / gist:4318396
Created December 17, 2012 13:48
Little reminder about REST :-D
Create -> Post
Read -> Get
Update -> Put
Delete -> Delete
@piscis
piscis / gist:4247496
Created December 9, 2012 23:30
Basic Doctrine2 GridFS example
/** @Document */
Class Image
{
/** @Id */
private $id;
/** @Field */
private $name;
/** @File */