Skip to content

Instantly share code, notes, and snippets.

View pgherveou's full-sized avatar

PG Herveou pgherveou

View GitHub Profile
@pgherveou
pgherveou / dabblet.css
Created May 9, 2014 20:36
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
var AWS = require('aws-sdk'),
converter = require('xml-json'),
Stream = require('stream'),
fs = require('fs'),
through = require('through2'),
zlib = require('zlib'),
crypto = require('crypto'),
mime = require('mime'),
pascalCase = require('pascal-case'),
gutil = require('gulp-util');
@pgherveou
pgherveou / convert.js
Last active August 29, 2015 14:14
transform image to a square rounded thumbnail
var fs = require('fs')
var spawn = require('child_process').spawn
var convertToSquare = spawn('convert', ['-quality', '1', '-', '-resize', '150x150^^', '-gravity', 'Center', '-extent', '150x150', 'PNG32:-'])
var convertToCircle = spawn('convert', ['-size', '150x150', 'xc:none', '-fill', '-', '-draw', 'circle 75,75 75,1', 'PNG32:-'])
var readFile = fs.createReadStream('image.png')
var writeFile = fs.createWriteStream('image-150x150-circle.png')
readFile.pipe(convertToSquare.stdin)
@pgherveou
pgherveou / emitter.swift
Last active August 29, 2015 14:17
event emitter in swift
private var autoId: Int = 1
// MARK: Subscription Protocol
protocol Subscription {
func remove()
}
// MARK: AbstractSubscription<T>
@pgherveou
pgherveou / viewcontroller-tpl.swift
Created April 20, 2015 13:35
View Controller code style template
import Foundation
import UIKit
class <#name#>: UIViewController {
// MARK: static properties
struct statics {
static let someValue = 1
static let someOtherValue = "foo"
import Foundation
// global singleton instance
let tweaks = FBTweakStore.sharedInstance()
/**
* ## Usage
*
* class MyClass {
* struct statics {
@pgherveou
pgherveou / dabblet.css
Created December 20, 2011 12:45
table display test
/**
* table display test
*/
body {
min-height:100%;
padding-top: 100px
}
div {
outline: 2px solid grey;
@pgherveou
pgherveou / gist:1709737
Created January 31, 2012 10:08
Socket io middelware
io = require 'socket.io'
io.Socket::onEvent = (ev, cbs...) ->
@on ev, (args...) ->
cbList = cbs.slice()
# set callback parameter if any
fn = args[args.length-1] if typeof args[args.length-1] is 'function'
@pgherveou
pgherveou / dabblet.css
Created February 26, 2012 12:48
Untitled
ul {
overflow: hidden;
*zoom: 1;
height: 50px;
background: #333;
color: white;
}
li {
@pgherveou
pgherveou / dabblet.css
Created February 26, 2012 13:05
Untitled
body {
/*background-color: blue*/
}
ul {
overflow: hidden;
*zoom: 1;
height: 150px;
background: #333;
color: white;