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 / 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 / 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 / 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 / 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 / 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 / image.js
Created January 30, 2013 19:26
PhantomJS script to print the source of the first image
var page = require('webpage').create();
page.content = '<html><body><img src="foo.png">';
console.log(page.evaluate(function () {
return document.images[0].src;
}));
phantom.exit();
@ariya
ariya / find-github-commits.sh
Created September 19, 2012 05:37
Find some Git commits and print out the subject and GitHub link
#!/bin/bash
if [ "$#" == "0" ]; then
echo "Usage: find-github-commits issue-number"
exit 1
fi
repo=$(git config --get remote.origin.url | cut -d ':' -f 2 | sed 's/....$//')
for commit in $(git rev-list --reverse origin/master)
@ariya
ariya / vimrc
Created July 28, 2012 01:54
vimrc
set number
set ruler
syntax on
color darkblue
set nowrap
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
@ariya
ariya / gist:2950246
Created June 18, 2012 19:31
null stack in ChromeClient
diff --git a/src/qt/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/src/qt/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
index c8e40e6..fe98941 100644
--- a/src/qt/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
+++ b/src/qt/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
@@ -305,7 +305,9 @@ void ChromeClientQt::addMessageToConsole(MessageSource src, MessageType type, Me
// the MessageType value isn't useful - it will be LogMessageType for both errors
// and log messages.
if (level == ErrorMessageLevel) {
- QString stack = callStack->buildInspectorArray()->toJSONString();
+ QString stack = "[]";
@ariya
ariya / license.txt
Created April 8, 2012 16:24
Malicious PHP masqueraded as WordPress license.txt
<?php
$GLOBALS['_1660021129_'] = Array(
'sprintf',
'ip2long',
'substr_count',
'sleep',
'strpos',
'preg_replace',
'stripos',
'gethostbyaddr',