Skip to content

Instantly share code, notes, and snippets.

View ariya's full-sized avatar
💭
I may be slow to respond.

Ariya Hidayat ariya

💭
I may be slow to respond.
View GitHub Profile
@ariya
ariya / Twenty Thousands Leagues inside the Optical Fiber.md
Created April 25, 2014 15:34
Twenty Thousands Leagues inside the Optical Fiber

Twenty Thousands Leagues inside the Optical Fiber

What actually happens as we post a hundred-character tweet, run npm install, chat with our remote colleagues, and let the operating system updates itself? Numerous interactions are triggered in each of the 7 OSI communication layers but one thing that is not often discussed enough is the very important physical layer. The complicated network of undersea fiber optic cables, with its record-breaking transmission capacity (light can easily send the contents of a stack of Bluray discs in a few milliseconds), is the foundation of modern communication for our civilization.

This talk gives a historical journey of this remarkable achievement, a series of scientific milestones in the recent human history. It covers the topic on how to trap photons inside a hair-thin strand of glass, modulate them to carry some useful information in 40 different wavelengths, force the photons to travel thousands of miles, and finally stitch back the bits and pieces for a full r

@ariya
ariya / Vagrantfile
Last active August 29, 2015 14:04
Vagrantfile CentOS for PhantomJS 2
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "centos"
config.vm.provision "shell",
inline: "yum -y update && yum -y install gcc gcc-c++ make flex bison gperf ruby openssl-devel freetype-devel fontconfig-devel libicu-devel sqlite-devel"
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--memory", 3072]
@ariya
ariya / global.expected.txt
Created July 28, 2014 06:52
Sample test for PhantomJS 2
typeof phantom is object
typeof phantom.version is object
typeof phantom.args is object
typeof phantom.args.length is number
typeof phantom.scriptName is string
typeof phantom.exit is function
phantom.version.major is 2
phantom.version.minor is 0
phantom.version.patch is 0
@ariya
ariya / wrapper.md
Last active August 29, 2015 14:15
ES5 and ES6 parser

es5parser requires esprima 1.x and exports as es5parser.

es6parser requires esprima 2.x and exports as es6parser.

es7parser requires esprima-fb 7.x and exports as es7parser.

esparser requires all es5parser and es6parser and es7parser, switches the parser based on the language option.

@ariya
ariya / keybase.md
Created April 4, 2015 03:22
keybase

Keybase proof

I hereby claim:

  • I am ariya on github.
  • I am ariya (https://keybase.io/ariya) on keybase.
  • I have a public key whose fingerprint is 1CE9 829F 2840 5D6E B3D2 F474 FC22 3713 DB2D 17EE

To claim this, I am signing this object:

@ariya
ariya / post.js
Created May 28, 2011 09:09
Example using HTTP POST operation
var page = new WebPage(),
server = 'http://posttestserver.com/post.php?dump',
data = 'universe=expanding&answer=42';
page.open(server, 'post', data, function (status) {
if (status !== 'success') {
console.log('Unable to post!');
} else {
console.log(page.content);
}
@ariya
ariya / pizza.js
Created May 29, 2011 05:33
Find pizza in New York using Google Local
var page = new WebPage();
page.onConsoleMessage = function (msg) {
console.log(msg);
};
page.open('http://www.google.com/m/local?site=local&q=pizza+in+new+york', function (status) {
if (status !== 'success') {
console.log('Unable to access network');
} else {
@ariya
ariya / netsniff.js
Created June 7, 2011 07:08
onResourceRequested example
var page = new WebPage(), address, resources = [];
if (phantom.args.length === 0) {
console.log('Usage: netsniff.js <some URL>');
phantom.exit();
} else {
address = phantom.args[0];
page.onLoadStarted = function () {
page.startTime = Date.now();
@ariya
ariya / result.txt
Created June 7, 2011 07:08
m.bing.com
All resources:
[
{
"method": "GET",
"url": "http://m.bing.com/",
"time": 1
},
{
"method": "GET",
"url": "http://m.bing.com/css/1/V1/common.css",
Increase the goat teleporter timeout threshold to 100 because the old
value of 10 caused problems for extremely overweight goats. Tests show
that the largest goat in existence should be teleported in 50ms, so...
BUG=31337,2754
TEST=Try loading an overweight goat and confirm the teleporter works.