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 / include.js
Created December 22, 2011 08:24
Simple javascript include
function include(url) {
var element;
switch (url.split(".").pop()) {
case "css":
{
element = document.createElement("link");
element.setAttribute("rel", "stylesheet");
element.setAttribute("type", "text/css")
element.setAttribute("href", url)
}
@n1k0
n1k0 / this_is_magic.js
Created December 24, 2011 08:00
`this` is magic
function Foo() {
var self = this;
this.hello = function(fn) {
fn.apply(self, Array.prototype.splice.call(arguments, 1));
};
this.bar = function(what) {
console.log('ok:' + what);
};
}
def find_thread_for_proposal(self, proposal):
"""Finds comment thread for proposal"""
sql = """
with recursive path as (
select
id,
array[id] as path,
description,
profile_id,
created_at,
>>> import cong
>>> cong.lets_get_the_party_started()
[13:39] <niko-> basiquement pouvoir gérer un référentiel de contenus (documents), un layout, une navigation
[13:39] <niko-> idalement en markdown
[13:39] <niko-> un truc facilement maintenable
[13:40] <niko-> sans serveur d'appli nécessaire, pouvoir servir le truc en statique
[13:40] <niko-> déploiement avec un post-commit hook sur une branche de prod
[13:41] <niko-> pouvoir gérer des métadonnées, bien sûr, mais avec genre de la surcharge de template hérité
[13:49] <niko-> ou alors je retente Hyde https://github.com/lakshmivyas/hyde
[13:49] <niko-> ça a l'air d'avoir pas mal évolué
[13:49] <niko-> limite trop, peut-être :p
@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();