Skip to content

Instantly share code, notes, and snippets.

View anthonybudd's full-sized avatar

Anthony C. Budd anthonybudd

View GitHub Profile
// PASTE INTO JS CONSOLE ON FREEAGENT
(function(){
var canvas = document.createElement("canvas");
canvas.width = 16;
canvas.height = 16;
var ctx = canvas.getContext('2d');
var loop = setInterval(function(){
if($('span.running').length == 0){
$('link[rel="Shortcut Icon"]').attr('href', '/favicon.ico');
}else{
@anthonybudd
anthonybudd / IncrementSelectionCommand.py
Last active November 10, 2016 11:06
THE BEST PLUGIN
# Sublime: Tools -> Developer -> New Plugin
# Preferences -> Key Bindings
# Default (OSX).sublime-keymap: { "keys": ["alt+1"], "command": "increment_selection" }
import sublime, sublime_plugin
class IncrementSelectionCommand(sublime_plugin.TextCommand):
def run(self, edit):
start_value = 1
@anthonybudd
anthonybudd / WP_Model-basic-class.php
Last active February 11, 2017 17:03
WP_Model class
<?php
Class Product extends WP_Model
{
public $postType = 'product';
public $attributes = [
'color',
'weight',
'seller_id'
];
<?php
Product::register();
// OR
Product::register([
'singular_name' => 'Product'
]);
<?php
$product = new Product;
$product->color = 'white';
$product->weight = 300;
$product->title = 'the post title';
$product->content = 'the post content';
$product->save();
// OR
$product = new Product([
'color' => 'blue',
<?php
$product = Product::find(15);
<?php
$firstProducts = Product::in(1, 2, 3, 4);
<?php
$greenProducts = Product::where('color', 'green');
//OR
$otherProducts = Product::where([
[
'key' => 'color',
'value' => 'green',
'compare' => '!='
<?php
$product->delete();