This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Fetch user agents by class from http://ua.theafh.net/ */ | |
function UserAgents () { | |
var COL_UA=1; | |
var COL_CLASS=3; | |
this.list=[]; | |
this.Class=''; | |
this.parse = function(Class) { | |
this.list=[]; | |
var self=this; | |
this.Class=Class; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple XMLHttpRequest | |
// based on https://davidwalsh.name/xmlhttprequest | |
var SimpleRequest = { | |
call: function(what, response) { | |
var request; | |
if (window.XMLHttpRequest) { // Mozilla, Safari, ... | |
request = new XMLHttpRequest(); | |
} else if (window.ActiveXObject) { // IE | |
try { | |
request = new ActiveXObject('Msxml2.XMLHTTP'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cp = require('child_process'); | |
var promiseAll = function(items, block, done, fail) { | |
var self = this; | |
var promises = [], | |
index = 0; | |
items.forEach(function(item) { | |
promises.push(function(item, i) { | |
return new Promise(function(resolve, reject) { | |
if (block) { | |
block.apply(this, [item, index, resolve, reject]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ES6 version of settle | |
Promise.settle = function(promises) { | |
function PromiseInspection(fulfilled, val) { | |
return { | |
isFulfilled: function() { | |
return fulfilled; | |
}, isRejected: function() { | |
return !fulfilled; | |
}, isPending: function() { | |
// PromiseInspection objects created here are never pending |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Listen Spotify MacOS App for Notifications | |
It currently supports | |
`com.spotify.client.PlaybackStateChanged` | |
@author: loretoparisi at gmail dot com | |
''' | |
import Foundation | |
import json | |
from AppKit import * | |
from PyObjCTools import AppHelper |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.fn.table2CSV = function(options) { | |
var options = jQuery.extend({ | |
separator: ',', | |
header: [], | |
delivery: 'popup' // popup, value | |
}, | |
options); | |
var csvData = []; | |
var headerArr = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function exportTableToCSV($table, filename, delimiter) { | |
var $headers = $table.find('tr:has(th)'), | |
$rows = $table.find('tr:has(td)') | |
// Temporary delimiter characters unlikely to be typed by keyboard | |
// This is to avoid accidentally splitting the actual contents | |
, | |
tmpColDelim = String.fromCharCode(11) // vertical tab character | |
, | |
tmpRowDelim = String.fromCharCode(0) // null character | |
// actual delimiter characters for CSV format |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This work is licensed under Creative Commons GNU LGPL License. | |
License: http://creativecommons.org/licenses/LGPL/2.1/ | |
Version: 0.9 | |
Author: Stefan Goessner/2006 | |
Web: http://goessner.net/ | |
*/ | |
function xml2json(xml, tab) { | |
var X = { | |
toObj: function(xml) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This work is licensed under Creative Commons GNU LGPL License. | |
License: http://creativecommons.org/licenses/LGPL/2.1/ | |
Version: 0.9 | |
Author: Stefan Goessner/2006 | |
Web: http://goessner.net/ | |
*/ | |
function json2xml(o, tab) { | |
var toXml = function(v, name, ind) { | |
var xml = ""; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* JSONPath 0.8.0 - XPath for JSON | |
* | |
* Copyright (c) 2007 Stefan Goessner (goessner.net) | |
* Licensed under the MIT (MIT-LICENSE.txt) licence. | |
*/ | |
function jsonPath(obj, expr, arg) { | |
var P = { | |
resultType: arg && arg.resultType || "VALUE", | |
result: [], | |
normalize: function(expr) { |