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
echo "Hello World!" > /tmp/helloWorld.txt |
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
# Get-DirStats.ps1 | |
# Written by Bill Stewart ([email protected]) | |
#requires -version 2 | |
# PowerShell wrapper script for the SysInternals du.exe command: | |
# https://docs.microsoft.com/en-us/sysinternals/downloads/du | |
# Why? Object output for sorting, filtering, calculating totals, etc. | |
# | |
# Version history: |
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
[Console]::Beep(130, 100) | |
Start-Sleep -Milliseconds 1 | |
[Console]::Beep(262, 100) | |
Start-Sleep -Milliseconds 1 | |
[Console]::Beep(330, 100) | |
Start-Sleep -Milliseconds 1 | |
[Console]::Beep(392, 100) | |
Start-Sleep -Milliseconds 1 | |
[Console]::Beep(523, 100) | |
Start-Sleep -Milliseconds 1 |
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
// 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; | |
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
// 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 |
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
// 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 = ""; |
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
// 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 |
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
// 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% |
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
// 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; | |
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
// Bonfire: Factorialize a Number | |
// Author: @rjmccallumbigl | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-factorialize-a-number?solution=function%20factorialize(num)%20%7B%0A%20%20%0A%20%20var%20num2%20%3D%200%3B%0A%20%20var%20i%20%3D%201%3B%0A%20%20%0A%20%20%20%20if%20(num%20%3D%3D%3D%200)%7B%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20return%201%3B%0A%20%20%20%20%20%20%0A%20%20%20%20%7D%0A%0A%20%20%0A%20%20while%20(num%20%3E%202)%20%7B%0A%20%20%20%20%0A%20%20%20%20i%20*%3D%20num%3B%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20num--%3B%0A%20%20%20%20%0A%20%20%20%20%7D%0A%20%20%0A%20%20i%20*%3D%202%3B%0A%20%20%0A%20%20%20%20return%20i%3B%0A%20%20%0A%20%20%2F%2Freturn%20num%3B%0A%7D%0A%0Afactorialize(5)%3B%0A | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function factorialize(num) { | |
var num2 = 0; | |
var i = 1; | |