Skip to content

Instantly share code, notes, and snippets.

View Jaballadares's full-sized avatar

John Balladares Jaballadares

View GitHub Profile
@felipelavinz
felipelavinz / dateHelper.js
Created May 13, 2010 14:05
A very simple class for some basic dates operations in Javascript
/**
* 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
@pamelafox
pamelafox / jsonexport.js
Created June 27, 2011 23:58
JSON Export Apps Script
// 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.
@lsauer
lsauer / gist:1305056
Created October 21, 2011 21:40
Easiest way to find duplicate values in a JavaScript array - Native unique function implementation
//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;});}
@rlemon
rlemon / utils.js
Created March 23, 2012 15:58
Javascript common Utility functions.
/* 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);
}
@catchamonkey
catchamonkey / mailtoLinkTracking.js
Created May 30, 2012 08:41
Infinity Tracking - Custom Trigger for all mailto links
/**
* 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 <chris.sedlmayr@infinity-tracking.com>
*/
// copy of initialise the infinity var
var _ictt = _ictt || [];
$(document).ready(function() {
// find 'a' elements that have an href starting with mailto:
@atomize
atomize / GASjson2SS.js
Last active December 11, 2023 21:26 — forked from mhawksey/gist:1442370
Google Apps Script to read JSON and write to sheet
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;
}
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active July 7, 2024 19:32
A badass list of frontend development resources I collected over time.
@RIAEvangelist
RIAEvangelist / Install Cloud9 on local or remote computer, server, or raspberry pi
Last active June 6, 2023 03:37
This gist will help you install Cloud9 on your local or remote computer, server, or even your raspberry pi. Many people are having issues at the time of this Gist's creation.
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();
/*
Autosend Invites to anyone that shares X number of connections with you.
Way to use this script:
1. Save it as a bookmarklet
2. Go to 'People you may know'
3. Click on this bookmarklet.
4. Enter number of overlapping connections
5. Check your console