This simple force-directed graph shows character co-occurence in Les Misérables. A physical simulation of charged particles and springs places related characters in closer proximity, while unrelated characters are farther apart. Layout algorithm inspired by Tim Dwyer and Thomas Jakobsen. Data based on character coappearence in Victor Hugo's Les Misérables, compiled by Donald Knuth.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Fit canvas to viewport for mobile devices</title> | |
<style> | |
* { | |
margin: 0; | |
padding: 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var links = document.querySelectorAll('.ogAggregationSubstorySlideHeadline > a'); | |
for( var i=0, len=links.length; i < len; i += 1) { | |
var url = links[i].getAttribute('href'); | |
url = decodeURIComponent(url.split("?")[1].split("&")[2].split("=")[1]); | |
links[i].setAttribute('href',url); | |
links[i].setAttribute('target','_blank'); | |
} | |
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Generating stronger PHP session IDs | |
// Change from default PHPSESSID | |
ini_set('session.name','my_cookie'); | |
// Use only cookies to prevent session ID hijacking | |
ini_set('session.use_cookies', 'true'); | |
ini_set('session.use_only_cookies', 'true'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('http').request({ | |
host: 'example.com', | |
path: '/path/to/get', | |
method: 'GET' | |
}, function(res) { | |
res.setEncoding('utf8'); | |
var body = ''; | |
res.on('data', function(chunk) { | |
body += chunk; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A few terminal commands to determine SSD, display manufacturer | |
// Display Manufacturer | |
ioreg -lw0 | grep \"EDID\" | sed "/[^<]*</s///" | xxd -p -r | strings -6 | |
LPXXXX = LG | |
LSNXXXX = Samsung | |
// SSD Manufacturer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import markdown2 | |
class CustomMarkdown(markdown2.Markdown): | |
""" | |
Custom markdown processor that we use for task list | |
""" | |
reTaskList = re.compile(''' | |
(?P<prefix>[\r\n|\n|\r]*) |
I hereby claim:
- I am Checksum on github.
- I am checksum (https://keybase.io/checksum) on keybase.
- I have a public key whose fingerprint is EEA1 CD10 320D 497A B440 F6BD 45DD 4E24 58A5 101A
To claim this, I am signing this object:
CREATE TABLE users(
id serial not null primary key,
username text not null
);
CREATE TABLE tweets(
id serial not null primary key,
content jsonb default('{}')
);
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Function to automatically create a user_id column for new tables with name starting with user_ | |
create or replace function create_user_id_column() | |
returns event_trigger | |
language plpgsql volatile as | |
$$ | |
declare | |
obj record; | |
identity text[]; | |
begin | |
for obj in select * from pg_event_trigger_ddl_commands() |
OlderNewer