Skip to content

Instantly share code, notes, and snippets.

James R Lowrey JarLowrey

Block or report user

Report or block JarLowrey

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@JarLowrey
JarLowrey / vs_code_settings.json
Created Apr 9, 2018
Visual Studio Code personal settings
View vs_code_settings.json
{
"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 Jul 16, 2017
Benchmark for Ruby String ID creation
View benchmark_ruby_string_id_creation.rb
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
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
View exporter.xml
<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 Mar 29, 2017
convert most video files around, supports "gif". Can customize ffmpeg options. Use via "sh vid_convert.sh filename outputExtension"
View vid_convert.sh
#!/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 Mar 11, 2017
Make automatic, parallel requests to Google Maps to quickly find all your places
View GoogleGeocoder.html
<!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 Feb 9, 2017
Get your Atom editor bootstrapped and ready for best-practices
View atom_stater_pack.sh
#!/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 Aug 22, 2016
Links to copy-right free asset repositories
View asset_links.txt
@JarLowrey
JarLowrey / convert_audio.sh
Last active Apr 21, 2016
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'.
View convert_audio.sh
#!/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 Jul 19, 2016
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.
View concatenate_imgs_in_subdirectories.bash
#!/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 Apr 7, 2016
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.
View phaser_preloading_spritesheets_function_calls.bash
#!/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))
};
You can’t perform that action at this time.