Last active
February 26, 2019 17:10
-
-
Save jneidel/1fec38f5309f8c1ca6af5551c21c22fc to your computer and use it in GitHub Desktop.
Revisions
-
jneidel revised this gist
Feb 26, 2019 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -36,3 +36,9 @@ let b = "b"; // https://github.com/30-seconds/30-seconds-of-code#hextorgb- // RGBToHex // https://github.com/30-seconds/30-seconds-of-code#rgbtohex // uuidv4 // https://github.com/30-seconds/30-seconds-of-code#uuidgeneratornode // colorize // https://github.com/30-seconds/30-seconds-of-code#colorize -
jneidel revised this gist
Feb 26, 2019 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -34,3 +34,5 @@ let b = "b"; // hexToRGB // https://github.com/30-seconds/30-seconds-of-code#hextorgb- // RGBToHex // https://github.com/30-seconds/30-seconds-of-code#rgbtohex -
jneidel revised this gist
Feb 26, 2019 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -31,3 +31,6 @@ const zip = rows => rows[0].map( ( _, c ) => rows.map( row => row[c] ) ); let a = "a"; let b = "b"; [ b, a ] = [ a, b ]; // hexToRGB // https://github.com/30-seconds/30-seconds-of-code#hextorgb- -
jneidel revised this gist
Jul 25, 2018 . 1 changed file with 3 additions and 10 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -5,14 +5,10 @@ function range( min, max ) { } // Return a random number from specified range const randomNum = ( min, max ) => Math.floor( ( Math.random() * max ) + min ); // Get width of window const windowWidth = () => "innerWidth" in window ? window.innerWidth : document.documentElement.offsetWidth; // Return name of current function function funcName() { @@ -25,11 +21,8 @@ function sortNumbers( array ) { array.sort( function( a, b ) { return a - b; } ); } // Capitalize single word const capitalize = str => str.charAt( 0 ).toUpperCase + str.slice( 1 ); // Interweve two array, see pythons zip const zip = rows => rows[0].map( ( _, c ) => rows.map( row => row[c] ) ); -
jneidel revised this gist
May 29, 2018 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -31,6 +31,9 @@ function capitalize( str ) { return str.charAt( 0 ).toUpperCase + str.slice( 1 ); } // Interweve two array, see pythons zip const zip = rows => rows[0].map( ( _, c ) => rows.map( row => row[c] ) ); // Swap item values let a = "a"; let b = "b"; -
jneidel revised this gist
Feb 17, 2018 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -30,3 +30,8 @@ function sortNumbers( array ) { function capitalize( str ) { return str.charAt( 0 ).toUpperCase + str.slice( 1 ); } // Swap item values let a = "a"; let b = "b"; [ b, a ] = [ a, b ]; -
jneidel created this gist
Jan 6, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ // Return an array of numbers for specified range function range( min, max ) { min -= 2; return Array.from( new Array( max - min - 1 ), ( x,i ) => i - min ); } // Return a random number from specified range function randomNum( min, max ) { return Math.floor( ( Math.random() * max ) + min ); } // Get width of window function windowWidth() { return "innerWidth" in window ? window.innerWidth : document.documentElement.offsetWidth; } // Return name of current function function funcName() { const stack = new Error().stack; return stack.split( "" )[2].replace( /at/, "" ).replace( /\(.*?\)/, "" ).trim(); } // Sort Numbers in actual order function sortNumbers( array ) { array.sort( function( a, b ) { return a - b; } ); } // Capitalize single word function capitalize( str ) { return str.charAt( 0 ).toUpperCase + str.slice( 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ # Get path of current file def filePath(): return os.path.dirname( os.path.abspath( __file__ ) ) # Convert negative int into positive def toPositive( num ): return int( str( num ).strip( "-" )