Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Ariya Hidayat ariya

💭
I may be slow to respond.
View GitHub Profile
View gist:2246447
// 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 Mar 24, 2012
Result of fc-list
View gist:2178551
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
View syntax.json
{
"type": "Program",
"body": [
{
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "BinaryExpression",
@ariya
ariya / iframe.js
Created Mar 16, 2012
dump iframe content
View iframe.js
var page = require('webpage').create();
page.settings.loadImages = false;
page.onConsoleMessage = function(msg) { console.log(msg); };
page.onLoadFinished = function() {
page.evaluate(function() {
var getFrames = function(doc) {
var frames = doc.querySelectorAll('iframe');
for (var i = frames.length - 1; i >= 0; i--) {
var fdoc = frames[i].contentWindow.document;
@ariya
ariya / log.c
Created Mar 2, 2012
simple logging to file
View log.c
#include <stdarg.h>
#include <stdio.h>
static void log( char* string, ... )
{
va_list parameter;
char output[256];
FILE *f;
va_start( parameter, string );
@ariya
ariya / log.txt
Created Feb 14, 2012
jQuery Mobile startup log
View log.txt
jquery.js 17 [Anonymous] [object DOMWindow]
jquery.js 23 [Anonymous]
jquery.js 327 jQuery.fn.extend [object Object]
jquery.js 631 each Boolean,Number,String,Function,Array,Date,RegExp,Object, (Function)
jquery.js 495 isFunction Boolean,Number,String,Function,Array,Date,RegExp,Object
jquery.js 512 type Boolean,Number,String,Function,Array,Date,RegExp,Object
jquery.js 896 [Anonymous] 0, "Boolean"
jquery.js 896 [Anonymous] 1, "Number"
jquery.js 896 [Anonymous] 2, "String"
jquery.js 896 [Anonymous] 3, "Function"
@ariya
ariya / module.js
Created Jan 4, 2012
Module example transpiled by Traceur
View module.js
// What you write
module universe {
export var answer = 42;
}
// What Traceur produces
var universe =(function() {
"use strict";
Object.defineProperty(this, "answer", {
get: function() {
@ariya
ariya / tweetcount.js
Created Dec 25, 2011
Given a URL, get the tweeted count from the embedded Twitter widget
View tweetcount.js
// Given a URL, get the tweeted count from the embedded Twitter widget.
function findTweetCount(url, callback) {
var count = -1,
title = '';
function openWidget(location) {
var widget = require('webpage').create();
View qdom-cache-ariya.patch
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 / syntax.json
Created Oct 30, 2011
testing parse-js from UglifyJS
View syntax.json
[
"toplevel",
[
[
{
"name": "defun",
"start": {
"type": "name",
"value": "answer",
"line": 1,