Skip to content

Instantly share code, notes, and snippets.

@christian-oudard
christian-oudard / gfm.py
Created June 29, 2010 18:51
Github Flavored Markdown in Python
import re
from hashlib import md5
def gfm(text):
# Extract pre blocks.
extractions = {}
def pre_extraction_callback(matchobj):
digest = md5(matchobj.group(0)).hexdigest()
extractions[digest] = matchobj.group(0)
return "{gfm-extraction-%s}" % digest
@nanha
nanha / node.js express logger
Created July 5, 2011 00:49
node.js express middleware 중에서 logger를 사용하여 실제 파일로 logging 하는 방법
/**
* express 처음에 init 하시면 app.js 를 비롯하여 여러 디렉토리가 생기는데
* logs 디렉토리에 아무것도 안남는다고 의문을 가지신 분에게 도움이 될거 같습니다.
* connect의 middleware logger 는 기본이 stdout 으로 출력하고 있었네요.
* http://senchalabs.github.com/connect/middleware-logger.html
* manual을 살펴보니 stream options 이 있었군요.
* 한번 생각나서 fs core module의 createWriteStream 을 사용하여 해봤더니 잘되네요.
* 다른 방법도 있으신분은 알려주세요
*/
var fs = require('fs'),
@jrburke
jrburke / nulleval.js
Created August 17, 2011 20:58
(null,eval)('')
//Came across this in the es-discuss list, on the "clean scope" thread:
https://mail.mozilla.org/pipermail/es-discuss/2011-August/thread.html#16294
//I do not understand what the "null," part buys.
//Has to do something with scope(?), but at least in Firebug,
//I can see foo inside the string being evaled.
var foo = 'foo';
(null,eval)('(function(){console.log(foo);}())');
@abozhilov
abozhilov / gist:1333507
Created November 2, 2011 12:32
Arguments default value
function func(a, f) {
return function (args) {
args.__proto__ = a;
f.call(this, args);
};
};
var f = func({foo : 10, bar : 20}, function (args) {
print(args.foo, args.bar);
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@dunhamsteve
dunhamsteve / table.html
Last active May 21, 2024 22:06
Example of a scrollable table that only renders visible rows
<!-- This code is public domain, share and enjoy. -->
<html>
<style type="text/css" media="screen">
#table {
position: absolute;
top: 30px;
bottom: 0;
left: 10px;
right: 10px;
}
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active July 7, 2024 19:32
A badass list of frontend development resources I collected over time.
@ericelliott
ericelliott / essential-javascript-links.md
Last active July 18, 2024 15:03
Essential JavaScript Links
@bendc
bendc / functional-utils.js
Last active September 15, 2023 12:12
A set of pure ES2015 functions aimed to make functional JavaScript more idiomatic.
// array utils
// =================================================================================================
const combine = (...arrays) => [].concat(...arrays);
const compact = arr => arr.filter(Boolean);
const contains = (() => Array.prototype.includes
? (arr, value) => arr.includes(value)
: (arr, value) => arr.some(el => el === value)
@imjasonh
imjasonh / markdown.css
Last active May 24, 2024 22:56
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}