Skip to content

Instantly share code, notes, and snippets.

Avatar
🔷
Coding Hard

Jonathan Goode u01jmg3

🔷
Coding Hard
View GitHub Profile
@barryvdh
barryvdh / pre-commit
Last active Jul 7, 2022
phpunit pre-commit git hook
View pre-commit
#!/usr/bin/env php
<?php
echo "Running tests.. ";
exec('vendor/bin/phpunit', $output, $returnCode);
if ($returnCode !== 0) {
// Show full output
echo PHP_EOL . implode($output, PHP_EOL) . PHP_EOL;
echo "Aborting commit.." . PHP_EOL;
View ghe-revealer.rb
#!/usr/bin/sudo ruby
#
# revealer.rb -- Deobfuscate GHE .rb files.
#
# This is simple:
# Every obfuscated file in the GHE VM contains the following code:
#
# > require "ruby_concealer.so"
# > __ruby_concealer__ "..."
@nasirkhan
nasirkhan / laravel-commans.md
Last active Jul 22, 2020
Call laravel routes via command line
View laravel-commans.md

http://stackoverflow.com/questions/28866821/call-laravel-controller-via-command-line

There is no way so far (not sure if there will ever be). However you can create your own Artisan Command that can do that. Create a command CallRoute using this:

php artisan make:console CallRoute

This will generate a command class in app/Console/Commands/CallRoute.php. The contents of that class should look like this:

<?php namespace App\Console\Commands;
@mlocati
mlocati / win10colors.cmd
Last active Nov 27, 2022
ANSI Colors in standard Windows 10 shell
View win10colors.cmd
@echo off
setlocal
call :setESC
cls
echo %ESC%[101;93m STYLES %ESC%[0m
echo ^<ESC^>[0m %ESC%[0mReset%ESC%[0m
echo ^<ESC^>[1m %ESC%[1mBold%ESC%[0m
echo ^<ESC^>[4m %ESC%[4mUnderline%ESC%[0m
@mcaskill
mcaskill / Function.HTML-Build-Attributes.php
Last active Mar 2, 2021
PHP / WordPress : Generate a string of HTML attributes
View Function.HTML-Build-Attributes.php
<?php
if (!function_exists('html_build_attributes')) {
/**
* Generate a string of HTML attributes
*
* @param array $attr Associative array of attribute names and values.
* @param callable|null $callback Callback function to escape values for HTML attributes.
* Defaults to `htmlspecialchars()`.
* @return string Returns a string of HTML attributes.
View issues.md

Turning Off Github Issues

My friend Michael Jackson turned off github issues on one of his smaller projects. It got me thinking...

Maintainers getting burned out is a problem. Not just for the users of a project but the mental health of the maintainer. It's a big deal for both parties. Consumers want great tools, maintainers want to create them, but maintainers don't want to be L1 tech support, that's why they

@paragonie-scott
paragonie-scott / crypto-wrong-answers.md
Last active Nov 24, 2022
An Open Letter to Developers Everywhere (About Cryptography)
View crypto-wrong-answers.md
@joshbuchea
joshbuchea / force-lowercase-urls.php
Created Oct 18, 2015
A function to redirect uppercase URLs to lowercase.
View force-lowercase-urls.php
/**
* Changes the requested URL to lowercase.
*
* Only if URL does not include a filename or query variable.
*/
function force_lowercase_urls() {
// Grab requested URL
$url = $_SERVER['REQUEST_URI'];
// If URL contains a period, halt (likely contains a filename and filenames are case specific)
if ( preg_match('/[\.]/', $url) ) {
anonymous
anonymous / config.json
Created Oct 6, 2015
Bootstrap Customizer Config
View config.json
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "#ea4e1b",
"@brand-success": "#5cb85c",
@laziel
laziel / unlock.js
Created Sep 18, 2015
Unlock Web Audio in iOS 9 Safari
View unlock.js
var ctx = null, usingWebAudio = true;
try {
if (typeof AudioContext !== 'undefined') {
ctx = new AudioContext();
} else if (typeof webkitAudioContext !== 'undefined') {
ctx = new webkitAudioContext();
} else {
usingWebAudio = false;
}