Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Add Vagrant's NFS setup commands to sudoers, for `vagrant up` without a password
# Updated to work with Vagrant 1.6.x @see https://github.com/mitchellh/vagrant/pull/3638
# Stage updated sudoers in a temporary file for syntax checking
TMP=$(mktemp -t vagrant_sudoers)
cat /etc/sudoers > $TMP
cat >> $TMP <<EOF
# Allow passwordless startup of Vagrant when using NFS.
#!/bin/bash
PID_FILE=/var/run/mailcatcher.pid
NAME=mailcatcher
PROG="/usr/bin/env mailcatcher"
USER=mailcatcher
GROUP=mailcatcher
start() {
echo -n "Starting MailCatcher"
<?php
public function subscribeEvents()
{
Backend::$events->addEvent('shop:onExtendCategoryModel', $this, 'extend_category_model');
}
public function extend_category_model($category, $context)
{
@EHLOVader
EHLOVader / day.php
Last active January 2, 2016 01:39
PHP day class for managing a programmer's priorities.
<?php
class day(){
private $date;
public function __construct()
{
$this->date = time();
@EHLOVader
EHLOVader / gist:7645788
Created November 25, 2013 18:10
ADB transfer Google Authenticator data from one rooted Android phone to another.
adb pull /data/data/com.google.android.apps.authenticator2/databases/databases
adb push databases /data/data/com.google.android.apps.authenticator2/databases/databases
@EHLOVader
EHLOVader / Page.php
Last active December 25, 2015 15:58 — forked from anonymous/gist:7001873
<?php
foreach($products as $p){
echo $p->categories[0]->name . ' ' . $p->sku . ' ' . $p->created_at . ' </br>';
}
@EHLOVader
EHLOVader / gist:6902579
Last active December 25, 2015 02:29 — forked from GreatPotato/gist:6902395
Total number of items sold
<?php
$obj = new Shop_Product();
$obj->select('shop_products.id, sum(shop_order_items.quantity) AS "sold"');
$obj->join('shop_order_items', 'shop_products.id = shop_order_items.shop_product_id');
$obj->join('shop_orders', 'shop_order_items.shop_order_id = shop_orders.id');
$best_selling = $obj->where('shop_orders.payment_processed IS NOT NULL')->group('shop_products.id')->find_all();
@EHLOVader
EHLOVader / syntax.php
Last active July 3, 2017 15:58
Syntax highlighting test with HTML PHP and some tricky bits for testing that a highlighter is doing things right.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Text Highlight Demo</title>
<script type="text/javascript">
jQuery(function($,undefined){
var Sublime = {
"theme": "Flatland Dark.sublime-theme",
"color_scheme": "Packages/Monokai Extended/Monokai Extended.tmTheme",
@EHLOVader
EHLOVader / Numbers.sql
Last active December 23, 2015 00:39
Create a test table filled with 1000 numbers Based off single insert code sample #7 from SO http://stackoverflow.com/questions/1393951/what-is-the-best-way-to-create-and-populate-a-numbers-table Updated for MSSQL with conditional drop table to avoid errors Updated to use zero-based numbering, because it is better http://c2.com/cgi/wiki?WhyNumber…
/**
* NumbersTest
* Create a test table filled with 1000 numbers
*
* Based off single insert code sample #7 from the below SO
* @see http://stackoverflow.com/questions/1393951/what-is-the-best-way-to-create-and-populate-a-numbers-table
*
* Updated for MSSQL with conditional drop table to avoid errors
*/