Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
/** | |
* A very simple class for some basic Date operations | |
* @author Felipe Lavín <www.yukei.net> | |
*/ | |
var dateHelper = { | |
arrToDate : function(arr, format){ | |
/** | |
* Convert an array to a Date object | |
* @argument arr {Array} An array containing at least day-month-year | |
* @argument format {String} An string representation of the date format. Default: dd-mm-yyyy. More could be added as necessary |
// Exports current sheet as JSON and displays in message box. | |
function exportJSON() { | |
var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
var sheet = ss.getActiveSheet(); | |
var rowsData = getRowsData(sheet); | |
ss.msgBox(Utilities.jsonStringify(rowsData)); | |
} | |
// getRowsData iterates row by row in the input range and returns an array of objects. | |
// Each object contains all the data for a given row, indexed by its normalized column name. |
//lo sauer, 2011; lsauer.com | |
/** | |
* I saw this thread: http://stackoverflow.com/questions/840781/easiest-way-to-find-duplicate-values-in-a-javascript-array | |
* The solutions above lacked the elegance that can be done a with map-reduce-like operations | |
* Since this implementation works with native functions, the speed is in most circumstances faster | |
* than any solution using scripted-logic | |
* Additionally, I needed to quickly filter duplicate url-entries for: http://lsauer.github.com/chrome-session-restore/ | |
*/ | |
//copy and paste: without error handling | |
Array.prototype.unique = function(){return this.sort().filter( function(v,i,o){if(i>=0 && v!==o[i-1]) return v;});} |
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible). | |
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export. | |
var FORMAT_ONELINE = 'One-line'; | |
var FORMAT_MULTILINE = 'Multi-line'; | |
var FORMAT_PRETTY = 'Pretty'; | |
var LANGUAGE_JS = 'JavaScript'; | |
var LANGUAGE_PYTHON = 'Python'; |
/* Listener Object | |
* For event registration and unregistration | |
*/ | |
var listener = (function() { | |
function listenerAdd(elm, evt, func) { | |
if( elm.addEventListener ) { | |
elm.addEventListener(evt, func, false); | |
} else if( elm.attachEvent ) { | |
elm.attachEvent('on'+evt, func); | |
} |
/** | |
* Registers a click handler for all mailto links on the page and fires | |
* an Infinity Tracking custom trigger when clicked | |
* We use 'live' for mailto links loaded after the DOM is ready | |
* @author Chris Sedlmayr <[email protected]> | |
*/ | |
// copy of initialise the infinity var | |
var _ictt = _ictt || []; | |
$(document).ready(function() { | |
// find 'a' elements that have an href starting with mailto: |
function getJSON(aUrl,sheetname) { | |
//var sheetname = "test"; | |
//var aUrl = "http://pipes.yahoo.com/pipes/pipe.run?_id=286bbb1d8d30f65b54173b3b752fa4d9&_render=json"; | |
var response = UrlFetchApp.fetch(aUrl); // get feed | |
var dataAll = Utilities.jsonParse(response.getContentText()); // | |
var data = dataAll.value.items; | |
for (i in data){ | |
data[i].pubDate = new Date(data[i].pubDate); | |
data[i].start = data[i].pubDate; | |
} |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
Complete installation process: | |
sudo apt-get update | |
sudo apt-get upgrade | |
sudo apt-get install -y python-software-properties python make build-essential g++ curl libssl-dev apache2-utils git libxml2-dev | |
sudo apt-get update | |
sudo apt-get upgrade | |
cd ~ | |
mkdir git | |
cd ~/git |
/** | |
* Retrieves all the rows in the active spreadsheet that contain data and logs the | |
* values for each row. | |
* For more information on using the Spreadsheet API, see | |
* https://developers.google.com/apps-script/service_spreadsheet | |
*/ | |
function readRows() { | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var rows = sheet.getDataRange(); | |
var numRows = rows.getNumRows(); |