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 / bluetooth.ps
Created May 17, 2020
Windows Powershell Script to Toggle Bluetooth On or Off
View bluetooth.ps
[CmdletBinding()] Param (
[Parameter()][ValidateSet('On', 'Off')][string]$BluetoothStatus
)
If ((Get-Service bthserv).Status -eq 'Stopped') { Start-Service bthserv }
Add-Type -AssemblyName System.Runtime.WindowsRuntime
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0]
Function Await($WinRtTask, $ResultType) {
$asTask = $asTaskGeneric.MakeGenericMethod($ResultType)
$netTask = $asTask.Invoke($null, @($WinRtTask))
$netTask.Wait(-1) | Out-Null
View mp3tag.txt
// Tag → Filename
$replace($caps(%artist%),', ', & ,Ft,feat.,Vs,vs.) - ''$caps($replace($lower($replace(%title%,'',’)''),' (original mix)',,extended ,, mix, remix,' (',''' (','(','[',')',']',']''',']',' [mix]',,' [remix]',),''' [')
@u01jmg3
u01jmg3 / datatables.paging.js
Created Apr 27, 2020
DataTable Pager - Numbers with Ellipses - 1 ... 4 5 6 ... 50 Previous Next
View datatables.paging.js
$.fn.DataTable.ext.pager.numbersWithEllipses = function (page, pages) {
if (pages === 1) {
return [];
}
var numbers = [],
buttons = 3,
withEllipses = true;
var range = function (len, start) {
@u01jmg3
u01jmg3 / questions.txt
Last active Apr 17, 2020
Quiz Questions
View questions.txt
GEOGRAPHY
1. Which US state has the longest coastline? (Alaska)
2. How many timezones are there in China? (1)
3. What is the capital of Switzerland? (Bern)
4. What is the largest island in the world? (Greenland)
5. Which country is the largest producer of coffee? (Brazil)
6. What is the national sport of Canada? (Lacrosse)
7. What country spans all four hemispheres? (Kiribati)
8. What is the most northerly capital city in the world? (Reykjavik)
9. What country has three capital cities? (South Africa)
@u01jmg3
u01jmg3 / string-differences.php
Created Jan 30, 2020
Highlight string differences using `<del>` and `<ins>`
View string-differences.php
<?php
/**
* Generate two arrays:
* Values array: a list of elements as they appear in the diff
* Mask array: 0: unchanged, -1: removed, 1: added
*
* @param string $from
* @param string $to
* @return array
View rector-codeigniter.yml
# rector process application --config=rector-codeigniter.yml
parameters:
import_short_classes: false
php_version_features: '5.6' #'7.3'
autoload_paths:
- '..\composer_plugins\autoload.php' # '..\vendor\autoload.php'
- 'system\core'
- 'system\libraries'
- 'application\core'
- 'application\controllers'
@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"
You can’t perform that action at this time.