Skip to content

Instantly share code, notes, and snippets.

🎯
Coding Hard

Jonathan Goode u01jmg3

View GitHub Profile
@u01jmg3
u01jmg3 / shadows.scss
Last active Mar 22, 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) }
.shadow-inner { box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, .06) }
.shadow-outline { box-shadow: 0 0 0 3px rgba(66, 153, 225, .5) }
@u01jmg3
u01jmg3 / x.bat
Last active Mar 5, 2019
Image conversion
View x.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"
View create-app-logo-sizes.bat
@echo off
cls
echo Creating 59 icons, please wait.
im-convert ../../src/assets/images/app-logo-no-gradient.png ^
( -clone 0 -resize 2208x1242 -background #1f3165 -gravity center -extent 2208x1242 -write ../../platforms/ios/Assess/Images.xcassets/LaunchImage.launchimage/Default-Landscape-736h.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 ) ^
@u01jmg3
u01jmg3 / config
Last active Apr 2, 2018
Sourcetree Custom Actions
View config
[alias]
swaplast = !git tag _invert && git reset --hard HEAD~2 && git cherry-pick _invert _invert~1 && git tag -d _invert
invertindex = !git commit -m tmp1 && git add -A && git commit -m tmp2 && git swaplast && git reset HEAD~1 && git reset HEAD~1 --soft
cleanup = !git clean -df
allclean = !git reset --hard && git cleanup
quickclean = !git checkout . & git cleanup
@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.*
You can’t perform that action at this time.