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 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; | |
} |
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
/** | |
* AJAX API FOR PHP FUNCTION LIBRARY | |
* Place your functions below the header and then call them by posting to the script with any kind of ajax : | |
* $('#test').load('base/ajax/ajaxapi.php',{method:'sha256',params:"'batman','gargamelhatessmurfs'"}); for example. | |
*/ | |
if(function_exists(stripslashes(trim($_POST['method'])))){ //IF THE FUNCTION EXISTS (IN THIS SCRIPT) | |
$method = stripslashes(trim($_POST['method'])); | |
$params = str_replace("'", '',stripslashes(trim($_POST['params']))); //strip single quotes if used | |
$opts= explode(',',$params); //turn the parameters string into an array | |
$function = new ReflectionFunction($method); //instantiate the function as an object |
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 uploadPdfOcr() { | |
authorize(); | |
var key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // <-- developer key | |
var file = UrlFetchApp.fetch("http://somewhere.com/path/file.pdf").getBlob(); | |
var metadata = { title: file.getName() } | |
var params = {method:"post", | |
oAuthServiceName: "drive", | |
oAuthUseToken: "always", | |
contentType: "application/pdf", | |
contentLength: file.getBytes().length, |
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
/** | |
* 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(); |
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 getLatitudeLongitude($address) { | |
var geocode = Maps.newGeocoder() | |
.geocode($address); | |
// See http://goo.gl/5mr1N for reference | |
return geocode.results[0].geometry.location.lng + ', '+ geocode.results[0].geometry.location.lat; | |
} | |
function generateMap() { | |
var address = "111 8 Ave., New York, NY 10011"; | |
var mapUrl = Maps.newStaticMap() |
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
=ImportData(CONCATENATE("http://maps.google.com/maps/geo?output=kml&q=",A1:D1)) |
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
wget -p -m -k -K -E http://your.website.com/ |
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 get_dpi($filename){ | |
$a = fopen($filename,'r'); | |
$string = fread($a,20); | |
fclose($a); | |
$data = bin2hex(substr($string,14,4)); | |
$x = substr($data,0,4); | |
$y = substr($data,0,4); | |
return array(hexdec($x),hexdec($y)); |
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
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -verbose -activate -restart -agent -allowAccessFor -allUsers -privs -all -clientopts -setvnclegacy -vnclegacy yes -setvncpw -vncpw CHANGETHISTOAPASSWORDFORYOU |
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
<?php | |
$time = "Mon Apr 1 00:00:00 2013"; // Has a rando extra space for example purposes | |
$pattern = '/\s\s+/'; // fix that rando extra space with regex and preg_replace() | |
$str = preg_replace($pattern, ' ', $time); | |
$str = strtotime($str); // convert the time to UNIX time using built-in strtotime() function of PHP | |
$str = date('m/d/Y', $str); // use date() to convert accurate UNIX time to desired format | |
echo "\n".$str."\n"; // big pimpin' | |
?> |