Skip to content

Instantly share code, notes, and snippets.

Avatar
🔷
Coding Hard

Jonathan Goode u01jmg3

🔷
Coding Hard
View GitHub Profile
@gullyn
gullyn / flappy.html
Last active Sep 28, 2022
Flappy bird in 205 bytes (improved!)
View flappy.html
<body onload=z=c.getContext`2d`,setInterval(`c.width=W=150,Y<W&&P<Y&Y<P+E|9<p?z.fillText(S++${Y=`,9,9|z.fillRect(p`}*0,Y-=--M${Y+Y},P+E,9,W),P))):p=M=Y=S=6,p=p-6||(P=S%E,W)`,E=49) onclick=M=9><canvas id=c>
@zaratedev
zaratedev / .env.ci
Created Aug 31, 2020
Github actions for Laravel dusk
View .env.ci
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://127.0.0.1:8000
BCRYPT_ROUNDS=4
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
@stemar
stemar / varexport.php
Last active Aug 26, 2022
PHP var_export() with short array syntax (square brackets) indented 2 spaces.
View varexport.php
<?php
/**
* PHP var_export() with short array syntax (square brackets) indented 2 spaces.
*
* NOTE: The only issue is when a string value has `=>\n[`, it will get converted to `=> [`
* @link https://www.php.net/manual/en/function.var-export.php
* @param mixed $expression
* @param bool $return
* @return string
*/
@davidpiesse
davidpiesse / Schedulable.php
Last active Apr 22, 2022
Laravel Custom Class/Model Scheduling
View Schedulable.php
<?php
//Don't forget to change the namespace!
namespace App\Traits;
use Cron\CronExpression;
use Illuminate\Support\Carbon;
use Illuminate\Console\Scheduling\ManagesFrequencies;
trait Schedulable{
@imbrish
imbrish / MacroServiceProvider.php
Created Jan 30, 2018
Locale-aware & multi-key sorting of arrays
View MacroServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\Collection;
use Illuminate\Support\ServiceProvider;
class MacroServiceProvider extends ServiceProvider
{
/**
@ajdruff
ajdruff / fix-git-line-endings
Last active Sep 17, 2022
Forces all line endings to LF in your git repo.
View fix-git-line-endings
#####################
#
# Use this with or without the .gitattributes snippet with this Gist
# create a fixle.sh file, paste this in and run it.
# Why do you want this ? Because Git will see diffs between files shared between Linux and Windows due to differences in line ending handling ( Windows uses CRLF and Unix LF)
# This Gist normalizes handling by forcing everything to use Unix style.
#####################
# Fix Line Endings - Force All Line Endings to LF and Not Windows Default CR or CRLF
@timelf123
timelf123 / lower_bound.js
Created Sep 22, 2017 — forked from Gattermeier/lower_bound.js
Lower bound of Wilson score confidence interval for a Bernoulli parameter
View lower_bound.js
// Node.js implementation of Evan Miller's algorithm for ranking stuff based on upvotes:
// http://www.evanmiller.org/how-not-to-sort-by-average-rating.html
const stats = require('simple-statistics')
const lower_bound = (upvotes, n = 0, confidence = 0.95) => {
if (n === 0) return 0
// for performance purposes you might consider memoize the calcuation for z
const z = stats.probit(1-(1-confidence)/2)
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active Sep 21, 2022
Hyperlinks in Terminal Emulators
View Hyperlinks_in_Terminal_Emulators.md
@fgilio
fgilio / axios-catch-error.js
Last active Sep 16, 2022
Catch request errors with Axios
View axios-catch-error.js
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@giordanocardillo
giordanocardillo / README.MD
Last active Sep 15, 2022
Remove Office 2016 Product Key
View README.MD
  1. Open a command prompt as Administrator
  2. In the command prompt, type the following:
  • Office 2016 (32-bit) on a 32-bit version of Windows

    cscript "C:\Program Files\Microsoft Office\Office16\OSPP.VBS" /dstatus

  • Office 2016 (32-bit) on a 64-bit version of Windows

    cscript "C:\Program Files (x86)\Microsoft Office\Office16\OSPP.VBS" /dstatus

  • Office 2016 (64-bit) on a 64-bit version of Windows