git clone https://gist.github.com/ishu3101/6fb35afd237e42ef25f9
mv 6fb35afd237e42ef25f9 ConvertTo-Markdown
cd ConvertTo-Markdown
| let regex; | |
| /* matching a specific string */ | |
| regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello" | |
| regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO" | |
| regex = /hello/g; // looks for multiple occurrences of string between the forward slashes... | |
| /* wildcards */ | |
| regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo" | |
| regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo" |
| function getId() { | |
| /** | |
| * Imported from https://github.com/kyo-ago/UUID | |
| * Robbie Mitchell, @superstrong | |
| */ | |
| /** | |
| * UUID.core.js: The minimal subset of the RFC-compliant UUID generator UUID.js. | |
| * | |
| * @fileOverview |
| function ChunkyCache(cache, chunkSize){ | |
| return { | |
| put: function (key, value, timeout) { | |
| var json = JSON.stringify(value); | |
| var cSize = Math.floor(chunkSize / 2); | |
| var chunks = []; | |
| var index = 0; | |
| while (index < json.length){ | |
| cKey = key + "_" + index; | |
| chunks.push(cKey); |
| =LOWER(CONCATENATE(DEC2HEX(RANDBETWEEN(0;POWER(16;8));8);"-";DEC2HEX(RANDBETWEEN(0;POWER(16;4));4);"-";"4";DEC2HEX(RANDBETWEEN(0;POWER(16;3));3);"-";DEC2HEX(RANDBETWEEN(8;11));DEC2HEX(RANDBETWEEN(0;POWER(16;3));3);"-";DEC2HEX(RANDBETWEEN(0;POWER(16;8));8);DEC2HEX(RANDBETWEEN(0;POWER(16;4));4))) |
| function pullJSON() { | |
| var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
| var sheets = ss.getSheets(); | |
| var sheet = ss.getActiveSheet(); | |
| var url="http://example.com/feeds?type=json"; // Paste your JSON URL here | |
| var response = UrlFetchApp.fetch(url); // get feed | |
| var dataAll = JSON.parse(response.getContentText()); // |
| #!/bin/bash | |
| # Set the ROOM_ID & AUTH_TOKEN variables below. | |
| # Further instructions at https://www.hipchat.com/docs/apiv2/auth | |
| ROOM_ID=XXX | |
| AUTH_TOKEN=XXX | |
| MESSAGE="Hello world!" | |
| curl -H "Content-Type: application/json" \ |
| # You have your csv data and it looks like so... It's in a file named "my_data.csv" and we want to import it into a table named "my_things". | |
| "1", "Something", "0.50", "2013-05-05 10:00:00" | |
| "2", "Another thing", "1.50", "2013-06-05 10:30:00" | |
| # Now you want to import it, go to the command line and type: | |
| $ PGPASSWORD=PWHERE psql -h HOSTHERE -U USERHERE DBNAMEHERE -c "\copy my_things FROM 'my_data.csv' WITH CSV;" | |
| # Voila! It's impoted. Now if you want to wipe it out and import a fresh one, you would do this: |
| EMAIL = "[email protected]"; | |
| CALENDAR = "calendarname"; | |
| function weeklyReminder() { | |
| var StartDate = new Date(); | |
| var StartDateDD = StartDate.getDate() + 1; | |
| // Months are based on 0-11 so +1 | |
| var StartDateMM = StartDate.getMonth() + 1; | |
| var EndDateDD = StartDate.getDate() + 7; | |
| // Across months, the date will get messed up so...(NEEDS TESTING!) |
| //#!/usr/bin/env node | |
| var http = require("http"), | |
| fs = require("fs"), | |
| sys = require('sys'), | |
| exec = require('child_process').exec; | |
| var ENDPOINT="https://app.customer.io/api/v1/customers/"; | |
| var SITEID="YOUR SITE ID"; | |
| var APIKEY="YOUR API KEY"; |