Skip to content

Instantly share code, notes, and snippets.

@ja-k-e
ja-k-e / mp4_screens.sh
Last active August 29, 2015 13:56
Insanely specific script for generating screenshots of all mp4 files in a directory using ffmpeg. Creates named directory for each file's screenshots.
# for each mp4 file in current directory
for FILE in *.mp4
do
# get name of file sans the extension
NAME=${FILE%.*}
# make directory with file name
mkdir $NAME
# generate screens: currently 4 screens per second, starting at 1 second, for 5 seconds.
@ja-k-e
ja-k-e / 01 ffmpeg_bulk_splitter.sh
Last active August 29, 2015 14:02
Takes .txt files in project root, finds raw video with same filename in `raw` subdir, and cuts videos according to data on each line in the .txt file.
#!/bin/sh
# for each text file, convert corresponding video
for FILE in *.txt; do
# get movie file name
FILE_NAME=${FILE%.*}
# if movie exists
if [ -a "raw/$FILE_NAME.mp4" ]; then
@ja-k-e
ja-k-e / Regex for the People: Unstringify Integers and Floats.md
Last active June 3, 2016 09:27
Regex for the People: Unstringify Integers and Floats

###Initial String ["1", '123', "0.5", "10.5", "10.50", " 1 ", "1,000", ".5", "5.", "1.0.0", 1, "Windows 98"] ###Desired String [1, 123, 0.5, 10.5, 10.50, 1, "1,000", ".5", "5.", "1.0.0", 1, "Windows 98"] ###Goal: "Remove quotes surrounding valid integers or floats" ####Find Pattern ["'] *(\d+(.\d+)?) *["']

  • ["'] finds beginning of string (either " or ').
    • [] wraps character class
  • You can drop the [] wrapper and simplify to " or ' if all your strings are quoted the same way.
@ja-k-e
ja-k-e / Regex for the People: Valid JSON to CoffeeScript Object.md
Last active August 29, 2015 14:19
Regex for the People: Valid JSON to CoffeeScript Object

###Initial String { "user": { "username": "jakealbaugh", "email": "[email protected]" }, "number": 1 }

###Desired String

@ja-k-e
ja-k-e / Commafy Numbers in Sass.markdown
Last active August 29, 2015 14:21
Commafy Numbers in Sass

Commafy Numbers in Sass

Turns Sass integers and decimals into commafied strings for those of us that like putting CSS in the DOM. Basically, it makes a comma-separated list containing sliced sets of three numbers, converts the list to a string, and then removes spaces in the string. Would need to do a two-step replace on commas and decimals to get 1.000,20 format.

A Pen by Jake Albaugh on CodePen.

License.

@ja-k-e
ja-k-e / pen#PwLXXP.markdown
Last active August 29, 2015 14:21
pen#PwLXXP
@ja-k-e
ja-k-e / No JS: Tabs that scale down to menu.markdown
Last active August 29, 2015 14:21
No JS: Tabs that scale down to menu

No JS: Tabs that scale down to menu

A tab-to-menu layout that doesn't use javascript. Modern browser compatible.

A Pen by Jake Albaugh on CodePen.

License.

@ja-k-e
ja-k-e / pen#JoVrdw.markdown
Last active August 29, 2015 14:21
pen#JoVrdw
@ja-k-e
ja-k-e / CSS Rotary Clock.markdown
Last active August 29, 2015 14:21
CSS Rotary Clock
@ja-k-e
ja-k-e / Random Beat Sequencer (AudioContext Oscillators FTW).markdown
Last active August 29, 2015 14:21
Random Beat Sequencer (AudioContext Oscillators FTW)

Random Beat Sequencer (AudioContext Oscillators FTW)

Takes composition data, and data relative to each instrument and generates a random beat sequence.

A Pen by Jake Albaugh on CodePen.

License.