Skip to content

Instantly share code, notes, and snippets.

🎯
Coding Hard

Jonathan Goode u01jmg3

🎯
Coding Hard
Block or report user

Report or block u01jmg3

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
@u01jmg3
u01jmg3 / shadows.scss
Last active Apr 14, 2019
Box Shadows
View shadows.scss
// https://next.tailwindcss.com/docs/box-shadow/
.shadow { box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .1), 0 1px 2px 0 rgba(0, 0, 0, .06) }
.shadow-md { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -1px rgba(0, 0, 0, .06) }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -2px rgba(0, 0, 0, .05) }
.shadow-xl { box-shadow: 0 20px 25px -5px rgba(0, 0, 0, .1), 0 10px 10px -5px rgba(0, 0, 0, .04) }
.shadow-2xl { box-shadow: 0 25px 50px -12px rgba(0, 0, 0, .25) }
@u01jmg3
u01jmg3 / image.bat
Last active Mar 27, 2019
Image conversion
View image.bat
for %I in (*.svg) do convert -density 1536 -background none "%I" ( -clone 0 -background #989898 -shadow 80x3+5+5 ) -reverse -background none -resize 120x120 -gravity center -extent 192x192 -layers merge +repage "%~nI.png"
for %I in (*.svg) do outline-stroke "%I" -o "%I"
for %I in (*.svg) do svgo "%I"
@u01jmg3
u01jmg3 / unique-identifiers.php
Created Dec 29, 2018
Firebase push algorithm in PHP (firebase.com/blog/2015-02-11-firebase-unique-identifiers.html)
View unique-identifiers.php
<?php
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
@u01jmg3
u01jmg3 / fix-dictionaries.bat
Last active Mar 16, 2018
Fix dictionaries (SourceTree bug)
View fix-dictionaries.bat
@echo off
set regPath="HKEY_CURRENT_USER\Software\Microsoft\Spelling\Dictionaries"
set regName="_Global_"
set truncate=true
if "%truncate%"=="true" (
reg ADD %regPath% /t REG_MULTI_SZ /v %regName% /d "C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Office\16.0\be70806f\Proofing\RoamingCustom.dic" /f
) else (
for /f "tokens=2*" %%a in ('REG QUERY %regPath% /v %regName%') do set "regData=%%~b"
@u01jmg3
u01jmg3 / create-app-icons.bat
Last active Jun 1, 2019
ImageMagick + Pingo
View create-app-icons.bat
@echo off
cls
echo Creating 51 app icons, please wait.
im-convert ../../src/assets/images/app-logo-no-gradient.png ^
( -clone 0 -resize 2048x1536 -background #1f3165 -gravity center -extent 2048x1536 -write ../../platforms/ios/Assess/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x~ipad.png ) ^
( -clone 0 -resize 2048x1536 -background #1f3165 -gravity center -extent 2048x1536 -write ../screen/ios/screen-ipad-landscape@2x.png ) ^
( -clone 0 -resize 1536x2048 -background #1f3165 -gravity center -extent 1536x2048 -write ../../platforms/ios/Assess/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x~ipad.png ) ^
@u01jmg3
u01jmg3 / .gitconfig
Last active Aug 19, 2019
Sourcetree Custom Actions
View .gitconfig
[alias]
cordova = "!f(){ MESSAGE=\"Build assets for deployment\"; [ \"$(git log -1 HEAD --pretty=format:%s)\" != \"$MESSAGE\" ] && git allclean && cordova prepare --release && git add -A && git commit -m \"$MESSAGE\" && git push || echo \"Commit already present\"; }; f"
fetch-pr = "!f(){ git fetch origin refs/pull/$1/head:pr/$1; }; f"
cleanup = !git clean -df
quick-clean = !git checkout . & git cleanup
all-clean = !git reset --hard && git cleanup
swap-last = !git tag _invert && git reset --hard HEAD~2 && git cherry-pick _invert _invert~1 && git tag -d _invert
invert-index = !git commit -m tmp1 && git add -A && git commit -m tmp2 && git swap-last && git reset HEAD~1 && git reset HEAD~1 --soft
@u01jmg3
u01jmg3 / stripe.md
Created Feb 27, 2018
Modify style of 'Pay with Card' Stripe button using Bootstrap Sass
View stripe.md
  • Original Stripe button

stripe

  • With Bootstrap 3 styles applied

bootstrap

@u01jmg3
u01jmg3 / merge.js
Created Jun 26, 2017
Recursively merge properties and return a new object
View merge.js
/**
* Recursively merge properties
* and return a new object
* `merge(a, b[, ...])`
*
* @return object
*/
function merge() {
var dst = {},
src,
@u01jmg3
u01jmg3 / path.php
Created Jun 10, 2017
Generate an absolute or relative path based on the location of the current file
View path.php
<?php
// Absolute
$path = current(preg_split('@(?<=public)@', getcwd()));
require_once "{$path}\includes\config.inc.php";
// Relative
$path = preg_split('/public/', getcwd());
$path = explode(DIRECTORY_SEPARATOR, trim(end($path), DIRECTORY_SEPARATOR));
require_once str_repeat('../', count($path)) . 'includes/config.inc.php';
View config.md
  • Exclude dirs: .git|node_modules|vendor|storage|framework7|laravel-framework|cache
  • File Names match: *.env*|*.js|*.md|*.php|*css|*.xml|*.html|*.json|artisan|*.vue|*config|*access|*.bat|*.yml|*.ics|*.csv|*.xml|*.log|-*lock.*|*.svg
You can’t perform that action at this time.