Skip to content

Instantly share code, notes, and snippets.

View rjmccallumbigl's full-sized avatar
🌞

Ryan McCallum rjmccallumbigl

🌞
View GitHub Profile
@KartikTalwar
KartikTalwar / google-apps-script-json-parser.gs
Created January 10, 2017 02:07
Google Apps Script JSON Parser
// call this function on a cell via =ImportJSON("http://...") and data will show up verbatim
function ImportJSON(url) {
var response = UrlFetchApp.fetch(url);
var data = JSON.parse(response.getContentText());
if (!data.length) {
return [];
}
var rows = [];
@LindaLawton
LindaLawton / GmailSendMail.psi
Last active December 6, 2021 05:18
Step by step guild to using power shell to get a Google access token.
clear-host;
#Remove-Variable * -ErrorAction SilentlyContinue
#get-item Variable:*
#Get-Variable | Select-Object -ExpandProperty Name
. C:\Users\linda_l\Desktop\PowerShell\GoogleOauth.ps1
Add-Type -Path "C:\Users\linda_l\Documents\visual studio 2015\Projects\TestingLibrary\packages\AE.Net.Mail.1.7.10.0\lib\net45\AE.Net.Mail.dll"
Add-Type -AssemblyName System.IO
Add-Type -AssemblyName System.Text.Encoding
// Bonfire: Slasher Flick
// Author: @rjmccallumbigl
// Challenge: http://www.freecodecamp.com/challenges/bonfire-slasher-flick?solution=function%20slasher(arr%2C%20howMany)%20%7B%0A%20%20%2F%2F%20it%20doesn%27t%20always%20pay%20to%20be%20first%0A%20%20%0A%20%20var%20removed%3B%0A%20%20%0A%20%20removed%20%3D%20arr.splice(0%2C%20howMany)%3B%0A%20%20%0A%20%20return%20arr%3B%0A%7D%0A%0Aslasher(%5B1%2C%202%2C%203%5D%2C%202)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function slasher(arr, howMany) {
// it doesn't always pay to be first
var removed;
// Bonfire: Truncate a string
// Author: @rjmccallumbigl
// Challenge: http://www.freecodecamp.com/challenges/bonfire-truncate-a-string?solution=function%20truncate(str%2C%20num)%20%7B%0A%20%20%2F%2F%20Clear%20out%20that%20junk%20in%20your%20trunk%0A%20%20%0A%20%20var%20short%20%3D%20str%3B%0A%20%20var%20fromEnd%20%3D%200%3B%0A%20%20%0A%20%20%2F%2Freturn%20result%20if%20shorter%0A%20%20if%20(short.length%20%3C%20num)%7B%0A%20%20%20%20%0A%20%20%20%20return%20short%3B%0A%20%20%20%20%20%20%20%20%0A%20%20%7D%0A%20%20%0A%20%20%2F%2Freturn%20result%20if%20shorter%20than%203%20characters%0A%20%20%0A%20%20if%20(short.length%20%3C%3D%203)%7B%0A%20%20%20%20%0A%20%20%20%20short%20%3D%20str.slice(0%2C%20num)%3B%0A%20%20%20%20short%20%3D%20short.concat(%22...%22)%3B%0A%20%20%20%20return%20short%3B%0A%20%20%20%20%20%20%20%20%0A%20%20%7D%0A%20%20%0A%20%20%2F%2Fshorten%20string%20to%20n%20number%20of%20characters%0A%20%20if%20(short.length%20%3E%20num)%7B%0A%20%20%20%20%0A%20%20%20%20%2F%2Ffind%20out%20if%20we%20need%20to%20
// Bonfire: Repeat a string repeat a string
// Author: @rjmccallumbigl
// Challenge: http://www.freecodecamp.com/challenges/bonfire-repeat-a-string-repeat-a-string?solution=function%20repeat(str%2C%20num)%20%7B%0A%20%20%2F%2F%20repeat%20after%20me%0A%20%20%0A%20%20var%20i%20%3D%200%3B%0A%20%20var%20sentence%20%3D%20%22%22%3B%0A%20%20%0A%20%20while%20(i%20%3C%20num)%7B%0A%20%20%20%20%0A%20%20%20%20sentence%20%3D%20sentence.concat(str)%3B%0A%20%20%20%20i%2B%2B%3B%0A%20%20%20%20%0A%20%20%7D%0A%20%20%0A%20%20return%20sentence%3B%0A%7D%0A%0Arepeat(%22abc%22%2C%203)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function repeat(str, num) {
// repeat after me
var i = 0;
var sentence = "";
// Bonfire: Confirm the Ending
// Author: @rjmccallumbigl
// Challenge: http://www.freecodecamp.com/challenges/bonfire-confirm-the-ending?solution=function%20end(str%2C%20target)%20%7B%0A%20%20%2F%2F%20%22Never%20give%20up%20and%20good%20luck%20will%20find%20you.%22%0A%20%20%2F%2F%20--%20Falcor%0A%20%20%0A%20%20var%20splitArray%20%3D%20str.split(%22%22)%3B%20%20%0A%20%20var%20i%20%3D%200%3B%0A%20%20%0A%20%20var%20sub%20%3D%20str.substr(-target.length)%3B%0A%20%20%0A%20%20%2F%2Freturn%20the%20bool%20if%20last%20char%20matches%20or%20not%0A%20%20%2F*if%20(splitArray%5BsplitArray.length-1%5D%20%3D%3D%20target)%7B%0A%20%20%20%20%0A%20%20%20%20return%20true%3B%0A%20%20%20%20%0A%20%20%7D%20*%2F%0A%20%20%0A%20%20%2F%2Freturn%20splitArray%5BsplitArray.length-1%5D%3B%0A%20%20%0A%20%20%0A%20%20if%20(sub%20%3D%3D%20target)%20%7B%0A%20%20%20%20%0A%20%20%20%20return%20true%3B%0A%20%20%20%20%0A%20%20%7D%20else%20%7B%0A%20%20%20%20%0A%20%20%20%20return%20false%3B%0A%20%20%20%20%0A%20%20%7D%0A%20%20%0A%20%20%0A%20%20%0A%20%2
// Bonfire: Return Largest Numbers in Arrays
// Author: @rjmccallumbigl
// Challenge: http://www.freecodecamp.com/challenges/bonfire-return-largest-numbers-in-arrays?solution=function%20largestOfFour(arr)%20%7B%0A%20%20%2F%2F%20You%20can%20do%20this!%0A%20%20%0A%20%20var%20array%20%3D%20%5B%5D%3B%0A%20%20var%20i%20%3D%200%3B%0A%20%20var%20j%20%3D%200%3B%0A%20%20var%20x%20%3D%200%3B%0A%20%20var%20y%20%3D%200%3B%0A%20%20%0A%20%20%2F%2Freturn%20arr%3B%0A%20%20%0A%20%20for%20(i%20%3D%200%3B%20i%20%3C%204%3B%20i%2B%2B)%7B%0A%20%20%20%20%0A%20%20%20%20x%20%3D%200%3B%0A%20%20%20%20%0A%20%20%20%20for%20(j%20%3D%200%3B%20j%20%3C%204%3B%20j%2B%2B)%7B%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20if%20(arr%5Bi%5D%5Bj%5D%20%3E%20x)%7B%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20x%20%3D%20arr%5Bi%5D%5Bj%5D%3B%20%0A%20%20%20%20%0A%20%20%20%20%20%20%20%20%2F%2Freturn%20x%3B%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20array%5Bi%5D%20%3D%20x%3B%0A%
// Bonfire: Find the Longest Word in a String
// Author: @rjmccallumbigl
// Challenge: http://www.freecodecamp.com/challenges/bonfire-find-the-longest-word-in-a-string?solution=function%20findLongestWord(str)%20%7B%0A%20%20%0A%20%20var%20myArray%20%3D%20str.split(%22%20%22)%3B%0A%20%20var%20long%20%3D%200%3B%0A%20%20%0A%20%20%2F%2Freturn%20myArray%5B0%5D%3B%0A%20%20%0A%20%20for%20(var%20i%20%3D%200%3B%20i%20%3C%20myArray.length%3B%20i%2B%2B)%7B%0A%20%20%20%20%0A%20%20%20%20if%20(myArray%5Bi%5D.length%20%3E%20long)%7B%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20long%20%3D%20myArray%5Bi%5D.length%3B%0A%20%20%20%20%20%20%0A%20%20%20%20%7D%0A%20%20%20%20%0A%20%20%7D%0A%20%20%0A%20%20%2F%2Freturn%20str.length%3B%0A%20%20return%20long%3B%0A%7D%0A%0AfindLongestWord(%22What%20if%20we%20try%20a%20super-long%20word%20such%20as%20otorhinolaryngology%22)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function findLongestWord(str) {
var myArray = str.split(" ");
var long = 0;
@ataylor32
ataylor32 / beep_mario_victory_theme.ps1
Created July 24, 2014 05:02
Beep: Mario Victory Theme
[Console]::Beep(130, 100)
[Console]::Beep(262, 100)
[Console]::Beep(330, 100)
[Console]::Beep(392, 100)
[Console]::Beep(523, 100)
[Console]::Beep(660, 100)
[Console]::Beep(784, 300)
[Console]::Beep(660, 300)
[Console]::Beep(146, 100)
[Console]::Beep(262, 100)
@mharizanov
mharizanov / WiFiCheck
Created April 6, 2013 08:50
Script to check and re-connect WiFi on Raspberry Pi
#!/bin/bash
##################################################################
# A Project of TNET Services, Inc
#
# Title: WiFi_Check
# Author: Kevin Reed (Dweeber)
# dweeber.dweebs@gmail.com
# Project: Raspberry Pi Stuff
#
# Copyright: Copyright (c) 2012 Kevin Reed <kreed@tnet.com>