000 - One Hundred Days of Code
This collection of coding tips and tricks likely will be miscellaneous both in languages and content featured.
Round 000
-
Bash Date Calculations
Hacking time within the Bash shell
-
Bash Padding Strings
Pad string in Bash with zeros
-
JavaScript Padding Strings
Zero padding values with JavaScript
-
JavaScript Date Calculations
Hacking time with JavaScript
-
Awk Space Replace and Lowercase
String mutation Awk examples
-
Bash Multi-Line Variables
Assigning and appending to multi-line variable with Bash
-
JavaScript Boolean Gotchas
true
is coerced to a number but"true"
is not -
Bash Branching Without If
if
,then
, andfi
can be optional whenelif
is not used -
JavaScript Coerce Values
Convert strings to JavaScript Object types where available
-
Bash STDOUT to Array
Saving output of a command to an array
-
HTML Text Direction
Individual HTML elements can define text direction
-
Git Targeted Undo
Turning back time with Git
-
NodeJS Absolute Path
RegExp incantations for building absolute directory/file paths
-
Bash Case Changing Built-ins
Lower or upper case strings with Bash built-ins
-
Awk Floating Point Calculator
Dependency free floating point math from the command-line
-
Bash Error Trapping
Example of catching/inspecting Bash error states
-
JavaScript Reduce Key Value Pares
Example of
reduce
on objectentries
for uniq key value pares -
Bash Divide By Zero Gotcha
local
prevents trapping errors -
Python Argument List and Named Parameters
Example of accepting argument list before keyword parameters
-
JavaScript Convert Decimal to Another Base
Using
toString()
and Bitwise operators to convert numbers -
Awk float comparison hack for Bash
By default Bash does not support floating point number comparisons
-
JavaScript `String.indexOf()` tricks
String.indexOf()
returns first index of target character(s) within a string -
CSS counter and checkbox gotcha
counter-increment
reverts if checkbox state reverts -
Bash Command Redirection
Example of passing commands to another account
-
JavaScript Holey Arrays
Example of sanitizing empty slots
-
Awk RegExp variable
Example of matching Regular Expression defined by variable
-
Bash `if` RegExp
Example of Regular Expression branching/matching
-
JavaScript 2D Element Matrix
An example of using
Array(_n_).fill()
andArray.map()
-
Awk calling shell executable
Example of calling
ls
and reading STDOUT within Awk script -
JavaScript Type Inspection
Function that demonstrates some messy bits of JavaScript types
-
Bash range tip
The
{_start_.._end_}
syntax works in places other thanfor
loops -
JavaScript `async` callback example
Both
Array.map()
andArray.forEach()
methods are Asynchronous compatible -
Awk argument parsing
Example of parsing arguments within Awk script
-
Python publishing `entry_points` gotcha
entry_points["console_scripts"]
are imported by installed scripts -
Git hooks on push
Bash script that runs Git hooks on push
-
JavaScript Fibonacci Tail Recursion
Example calculating Fibonacci sequence using tail recursion
-
Bash send SSH commands
Example of using heredoc to send multiple commands to remote host
-
Python from Math Function
Example of translating Math function to Python syntax
-
JavaScript `this` quiz
Quick example of
this
scope and one big gotcha -
Python from Math summation
Example of translating Math summation to Python syntax
-
Bash Pattern Matching
Example of replacing characters that are not of numeric or alphabet class
-
JavaScript Ternary Operator
Example of conditional (ternary) operator within template literal
-
Awk Last Column
Example of obtaining and using last column Awk variable
-
JavaScript Fibonacci Generator
Example of using
yield
within a function to generate Fibonacci sequence -
Bash File Name Pattern Match
Example of extracting a file name with Pattern Match built-ins within Bash
-
Awk Sorted Unique Count
Using an Awk array (map) to sort and count unique lines or columns
-
Python Modulo Example
How to check if integer is even
-
JavaScript Decimal Conversion Challenge
Coding challenge, convert Decimal integer to another base
-
Bash Parameter Transformation
Example of using Bash Parameter Transformation options to prevent expansion
-
Awk `gsub` `FILENAME`
Example of using
gsub
function onFILENAME
to count post languages -
JavaScript Array Filter
Example of filtering an Array for odd or even numbers
-
Bash next post
Function that prints the index for new post file
-
Awk average column script
Example of using ternary operator to default undefined variables
-
JavaScript objectify cookies
Function that converts browser cookie string into JavaScript Object
-
Bash read file lines
Example of reading lines from a file without the
cat
command -
Python custom class
Example of a custom Python class with inheritance
-
Awk title case
Example script that title cases all words in string
-
HTML `oninput` Event
Example HTML and JavaScript for
oninput
event -
JavaScript `for` loop callback
Example of using callbacks within
for
loop iteration -
Bash string splitting trick
Example of using find and replace Bash built-ins on variables
-
Awk Find combo
Example of combining
awk
andfind
command-line utilities -
Three code publishing tips
Examples of how to separate the responsibilities of a project
-
Awk builtin linter
Examples of using the builtin linter within Awk from GNU
-
Python division gotcha
Examples of float vs integer division
-
HTML select option
Example of using
select
andoption
HTML elements and specific attributes -
Awk prefix input stream
Script that conditionally prefixes input stream
-
JavaScript character array
Example of using Spread Syntax in JavaScript to build character arrays
-
HTML5 subtitles
Example of using
track
andvideo
HTML5 elements -
Awk language counting script
Example of using Awk to print statistics about posts published
-
Python exception defaulting
Example of handling specific exception type and defaulting
-
Vim spelling shortcuts
Vim script plugin example
-
Bash join array
Function to join Bash array/list
-
Liquid comment gotcha
Warning
capture
blocks will interpret code withincomments
-
Vim script file type detection
Example of utilizing
&filetype
to detect specific file type -
Awk match between separator
Example of using
index
andsubstr
functions to extract between separator -
Python generator example
Example of using
yield
within a function -
Vim plugin writing tips
Examples and tips on writing and installing Vim plugin
-
JavaScript character counting function
Example of using
Array.reduce()
to count characters in a string -
Sass array gotchas
Array index addresses start at
1
not0
-
CSS Unicode
::before
and::after
pseudo elements may contain Unicode -
Liquid empty array
Example of how to initialize and append to an empty Liquid list
-
Awk average select columns
Example of Awk column selection by variable
-
Vim script arbitrary arguments
Example Vim script function that accepts arbitrary number of arguments
-
Bash string filters
Examples of using Bash built-ins for filtering before or after a pattern
-
Vim script catch specific exception
Example of re-throwing all but a specific exception type
-
Python file iterator
Example function for iterating over lines of a file
-
Bash enable Vi mode
How to enable Vi shortcuts within Bash shell
-
Python list comprehension
Example of using Python list comprehension to calculate factors of integer
-
JavaScript string to Unicode
Example of using spread syntax and
Array().map()
for string conversion -
Liquid `where` filter
Example of using
where
Liquid filter on a collection -
Awk array sorting
Example of using Awk built-ins for sorting columns
-
Python integer division
Example of using
//
operator instead ofmath.floor()
method -
Bash `select` options
Example of using
select
from list of options -
Vim auto-close braces
VimRC example for automatically closing braces/brackets
-
Python doc-strings
Examples of defining and accessing Python documentation
-
Vim move selection
Vim configurations to move visual selection up or down
-
JavaScript multidimensional matrix
Function for generating multidimensional matrices
-
Rust implement custom addition
Example of implementing math for custom data structure
-
Bash brace expansion
Examples of using Bash brace expansion for command-line operations
-
Vim jump splits
Vim configurations to jump between splits swiftly
-
End of first round
Review of first round learnings from 100 Days of Code challenge