Skip to content

Instantly share code, notes, and snippets.

@JarLowrey
JarLowrey / vs_code_settings.json
Created April 9, 2018 01:33
Visual Studio Code personal settings
{
"terminal.integrated.shellArgs.linux": [ //login shell
"--login"
],
"files.associations": {
"*.html.md.erb": "markdown", #Middleman
// "*.jsx": "javascript"
}
}
@JarLowrey
JarLowrey / benchmark_ruby_string_id_creation.rb
Created July 16, 2017 20:34
Benchmark for Ruby String ID creation
require 'benchmark'
#RESULTS - 100k iterations
# user system total real
# 0.590000 0.000000 0.590000 ( 0.594802) <- create_id_num - int to radix
# 0.270000 0.000000 0.270000 ( 0.267420) <- create_id_str - choosing random characters
@radix = ('0'..'9').to_a + ('a'..'z').to_a + ['$','-','_','+','!','*','(',')',','] #URL safe, lowercase characters
def self.custom_radix_to_s val, digits
@JarLowrey
JarLowrey / exporter.xml
Last active May 4, 2017 13:11
Physics Editor exporter for Godot Game Engine. Written by @aombk, re-hosted here. Unzip in C:\Program Files\CodeAndWeb\PhysicsEditor\resources\exporters - https://github.com/godotengine/godot/issues/3405#issuecomment-298074473
<exporter>
<!-- identifier of the exporter -->
<name>1godot.xml</name>
<!-- name for the dropbox -->
<displayName>Godot XML Exporter</displayName>
<!-- description of the exporter -->
<description>Godot XML Exporter by aombk</description>
@JarLowrey
JarLowrey / vid_convert.sh
Last active March 29, 2017 02:27
convert most video files around, supports "gif". Can customize ffmpeg options. Use via "sh vid_convert.sh filename outputExtension"
#!/bin/sh
echo $0
#with help from QA - http://apple.stackexchange.com/questions/103473/convert-animated-gif-to-mp4
#https://ffmpeg.org/ffmpeg.html
#required dependencies
#sudo apt-get install imagemagick
#sudo apt-get install ffmpeg
@JarLowrey
JarLowrey / GoogleGeocoder.html
Created March 11, 2017 20:07
Make automatic, parallel requests to Google Maps to quickly find all your places
<!DOCTYPE html>
<html>
<head>
<title>Geocoding service</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<!-- replace API key below -->
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAD0ItEHgyIPJ5yzJiC9bH8bnksY20JUeE&libraries=places"></script>
@JarLowrey
JarLowrey / atom_stater_pack.sh
Last active February 9, 2017 17:30
Get your Atom editor bootstrapped and ready for best-practices
#!/bin/sh
# Auto-run via:
# sh -c "$(curl -fsSL https://gist.githubusercontent.com/JTronLabs/941821b71a746dc31f418fd03a6c7236/raw/a7ad1b47d1ea72d06d304db3202475930b5362b6/atom_stater_pack.sh)"
echo "Downloading some awesome Atom packages. See the code at https://gist.github.com/JTronLabs/941821b71a746dc31f418fd03a6c7236"
#Editor
apm install linter # https://atom.io/packages/linter - available linters: http://atomlinter.github.io/
apm install highlight-selected # https://atom.io/packages/highlight-selected
@JarLowrey
JarLowrey / asset_links.txt
Created August 22, 2016 23:16
Links to copy-right free asset repositories
@JarLowrey
JarLowrey / convert_audio.sh
Last active April 21, 2016 18:58
Use SoX to batch convert audio files to a different format. First arg is currently existing format, second arg is the new audio format. All files will go into a new folder. Example: sh convert_audio.sh wav ogg -> will convert all .wav files in current directory to .ogg files, and place them in a folder named 'ogg'.
#!/bin/sh
mkdir $2
#adds a '.' to the beginning of the passed in string, if it is not already there
add_dot_to_beginning_of_args () {
initialLetter="$(echo $1 | head -c 1)"
one=$1
@JarLowrey
JarLowrey / concatenate_imgs_in_subdirectories.bash
Last active July 19, 2016 04:33
Searches in subdirectories for png files with names "frame-1.png", "frame-2.png"... and so on. Then makes a horizontal or vertical spritesheet out of the individual frames.
#!/bin/bash
#Directory setup: Individual images constituting one spritesheet must be by themselves in their own directory.
# All images must be '.png' files with that extension in their name.
# In a spritesheet directory, the images must be name frame-1.png thru frame-LAST_FRAME_NUMBER.png
#utilizes ImageMagick for spritesheet creation
@JarLowrey
JarLowrey / phaser_preloading_spritesheets_function_calls.bash
Last active April 7, 2016 15:36
Loop through all files in current directory. If ImageMagick thinks it is an image, output a preloading statement with that image's dimensions for the Phaser engine.
#!/bin/bash
echo $0 #this script requires ImageMagick, must be ran with bash
#copied from http://askubuntu.com/questions/179898/how-to-round-decimals-using-bc-in-bash
round()
{
echo $(printf %.f $(echo "scale=$2;(((10^$2)*$1)+0.5)/(10^$2)" | bc))
};