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
// 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",
@ariya
ariya / iframe.js
Created March 16, 2012 20:05
dump iframe content
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 March 2, 2012 18:37
simple logging to file
#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 February 14, 2012 03:21
jQuery Mobile startup log
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 January 4, 2012 23:30
Module example transpiled by Traceur
// 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 December 25, 2011 13:55
Given a URL, get the tweeted count from the embedded Twitter widget
// 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();
@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 / syntax.json
Created October 30, 2011 15:46
testing parse-js from UglifyJS
[
"toplevel",
[
[
{
"name": "defun",
"start": {
"type": "name",
"value": "answer",
"line": 1,