Skip to content

Instantly share code, notes, and snippets.

View n1k0's full-sized avatar
✏️
writing a github status

Nicolas Perriault n1k0

✏️
writing a github status
View GitHub Profile
@n1k0
n1k0 / test.md
Created March 8, 2012 09:32
A test.

This is a test, I repeat, this is a test.

Now edited.

@n1k0
n1k0 / image_utils.py
Created March 12, 2012 13:09
Python: Easy thumbnails using PIL
import os
from PIL import Image, ImageOps
def resize_image(path, box, out=None, fit=True, quality=75):
""" Downsample an image.
@param path: string - path to the original image
@param box: tuple(x, y) - the bounding box of the result image
@param out: file-like-object - save the image into the output stream
@n1k0
n1k0 / *.sublime-keymap
Created May 24, 2012 08:23
SublimeText2 macro and key binding for quickly wrapping text at 80 columns
/**
* Sample key binding (emacs users will hate it, but they're probably not using SublimeText2)
*
*/
[
{ "keys": ["ctrl+w"], "command": "run_macro_file", "args": {"file": "Packages/User/Quick Wrap.sublime-macro"}}
]
@n1k0
n1k0 / results.log
Created June 6, 2012 21:10
plain phantomjs test
$ phantomjs p.js
http://www.soshareit.com/mobile?frmnav=yes
http://www.soshareit.com/mobile?frmnav=yes
http://s7.addthis.com/js/250/addthis_widget.js
http://s7.addthis.com/js/250/addthis_widget.js
http://www.soshareit.com/css/style.css
http://www.soshareit.com/css/style.css
https://secure.quantserve.com/quant.js
https://secure.quantserve.com/quant.js
http://www.soshareit.com/js/slideshow.js
@n1k0
n1k0 / casper_speed.js
Created June 10, 2012 17:11
Silly benchmarks
var casper = require("casper").create();
var start = new Date().getTime();
var links = [
"http://google.com/",
"http://yahoo.com/",
"http://bing.com/"
];
casper.start();
@n1k0
n1k0 / Usage.md
Created June 18, 2012 12:00
casperjs test --includes

Invokation:

$ casperjs --includes=included_script.js test main_test_script.js

Output:

Test file: main_test_script.js 
@n1k0
n1k0 / SublimeLinter.sublime-settings
Created June 19, 2012 07:47
JSHint settings for SublimeLinter
{
"jshint_options":
{
"browser": true,
"eqeqeq": true,
"evil": true,
"regexdash": true,
"strict": true,
"sub": true,
"trailing": true
@n1k0
n1k0 / haha.log
Created June 20, 2012 15:14
haha
# apt-get install nodejs
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libc-ares2 libev4 libssl1.0.0 libv8-3.8.9.20 multiarch-support
The following packages will be REMOVED:
openssh-client openssh-server
The following NEW packages will be installed:
libc-ares2 libev4 libssl1.0.0 libv8-3.8.9.20 multiarch-support nodejs
@n1k0
n1k0 / sublime-day.js
Created June 28, 2012 09:32
Finds your daily SublimeText2 package using CasperJS. Yeah, randomly.
/**
* Finds your daily SublimeText2 package. Yeah, randomly.
*
* Requires CasperJS: http://casperjs.org/
*
* Usage: $ casperjs sublime-day.js
*/
var casper = require('casper').create();
var f = require("utils").format;
var packages = [];
@n1k0
n1k0 / fallback.py
Created June 28, 2012 15:30
Attribute fallback in Python - useful when you cannot extend an existing class, or want a proxy
class Bar(object):
def plop(self):
print 'plop'
class Foo(object):
def __init__(self):
self.bar = Bar()
def do(self):
print 'done'