Skip to content

Instantly share code, notes, and snippets.

Theron Smith thinkstylestudio

Block or report user

Report or block thinkstylestudio

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
@thinkstylestudio
thinkstylestudio / massInsertOrUpdate.php
Created Jan 14, 2020 — forked from RuGa/massInsertOrUpdate.php
Mass (bulk) insert or update on duplicate for Laravel 4/5
View massInsertOrUpdate.php
/**
* Mass (bulk) insert or update on duplicate for Laravel 4/5
*
* insertOrUpdate([
* ['id'=>1,'value'=>10],
* ['id'=>2,'value'=>60]
* ]);
*
*
* @param array $rows
@thinkstylestudio
thinkstylestudio / gist:53f30a12cb78116c7dedfb519fdfd346
Created May 7, 2019 — forked from stevegrunwell/gist:11c3e9d370127fa97898
Bulk-upgrade WordPress plugins using WP-CLI, committing each upgrade to Git as we go
View gist:53f30a12cb78116c7dedfb519fdfd346
#! /bin/bash
# Find available updates for WordPress plugins via WP-CLI, then upgrade theme one at a time.
# After each upgrade, commit the changed files to Git.
#
# Requires that WP-CLI be installed and in your path: http://wp-cli.org/
#
# Currently, it will only work when run from the root of the WordPress installation, and has
# a hard-coded path for wp-content/plugins.
#
@thinkstylestudio
thinkstylestudio / tip.sh
Created Jul 18, 2018 — forked from JeffreyWay/tip.sh
Ever want to undo everything that you've worked on since the last commit (including adding new files)? Here's a little alias to help with that.
View tip.sh
alias gundo='git reset HEAD~ && git clean -df'
@thinkstylestudio
thinkstylestudio / routes.sh
Created Jul 18, 2018 — forked from JeffreyWay/routes.sh
Add this to your ~/.bashrc file (or anywhere related) to give yourself an easy way to view the routes in your Laravel app, or filter the results down to a particular search query.
View routes.sh
function routes()
{
if [ $# -eq 0 ]; then
php artisan route:list
else
php artisan route:list | grep ${1}
fi
}
View wp_auto_install.sh
#!/bin/bash
# Default options
LOCALE="fr_FR"
DB_HOST='localhost'
VIRUSTOTAL_KEY='YOUR_KEY'
printf "Name of the project? cf My Project: "
read PROJECT_NAME
View print.css
/**
* Print Stylesheet fuer Deinewebsite.de
* @version 1.0
* @lastmodified 16.06.2016
*/
@media print {
/* Inhaltsbreite setzen, Floats und Margins aufheben */
/* Achtung: Die Klassen und IDs variieren von Theme zu Theme. Hier also eigene Klassen setzen */
View 1-macOS-10.13-high-sierra-setup.md

macOS 10.13 High Sierra Mostly-Automated Setup

An easy to refer to document for regularly setting up macOS 10.13 High Siera, in flavor of my previous macOS/OSX setup gists:

I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. I generally reinstall each computer from scratch every 6 months, and I do not perform upgrades between releases.

@thinkstylestudio
thinkstylestudio / macro.md
Created May 8, 2018 — forked from brunogaspar/macro.md
Recursive Laravel Collection Macros
View macro.md

What?

If a nested array is passed into a Laravel Collection, by default these will be threaded as normal arrays.

However, that's not always the ideal case and it would be nice if we could have nested collections in a cleaner way.

This is where this macro comes in handy.

Setup

@thinkstylestudio
thinkstylestudio / eloquent-cheatsheet.php
Created May 7, 2018 — forked from hassansin/eloquent-cheatsheet.php
Laravel 5 Eloquent CheatSheet #laravel #eloquent
View eloquent-cheatsheet.php
Model::
/*Select*/
select('col1','col2')
->select(array('col1','col2'))
->select(DB::raw('businesses.*, COUNT(reviews.id) as no_of_ratings, IFNULL(sum(reviews.score),0) as rating'))
->addSelect('col3','col4')
->distinct() // distinct select
/*From*/
View export runnable code from var_export.php
<?php
$macro = var_export($wpTermsArray, true);
$macro = str_replace("stdClass::__set_state", "(object)", $macro);
$wpTermsArray = '$data = ' . $macro . ';';
echo $wpTermsArray;
You can’t perform that action at this time.