Skip to content

Instantly share code, notes, and snippets.

View zachflower's full-sized avatar
💾

Zachary Flower zachflower

💾
View GitHub Profile
@zachflower
zachflower / todo.scpt
Last active August 29, 2015 14:01
Alfred AppleScript to add a new reminder to Apple's Reminders app
on alfred_script(q)
tell application "Reminders"
set nr to make new reminder
set name of nr to q
end tell
end alfred_script
@zachflower
zachflower / plexify.applescript
Last active August 29, 2015 14:02
AppleScript to migrate EyeTV recordings to Plex.
on run {input, parameters}
with timeout of (30 * 60) seconds
tell application "Finder"
repeat with anItem in the input
set parentFolder to container of anItem
set otherFiles to name of files in parentFolder
repeat with otherFile in the otherFiles
if otherFile ends with ".eyetvp" then
set xmlFile to (parentFolder as string) & ":" & otherFile
@zachflower
zachflower / is_anagram.php
Created June 13, 2014 01:03
PHP function to determine whether or not two strings are anagrams.
<?php
function is_anagram($a, $b) {
return(count_chars($a, 1)==count_chars($b, 1));
}
@zachflower
zachflower / Vagrantfile
Created September 22, 2014 17:20
Force installation of Vagrant plugins.
unless Vagrant.has_plugin?("<PluginName>")
system('vagrant plugin install <PluginName>')
raise("Plugin installed. Run command again.");
end
@zachflower
zachflower / MY_Input.php
Last active August 29, 2015 14:08
CodeIgniter input class, implementing PATCH and DELETE HTTP request methods
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Input extends CI_Input {
protected $raw;
protected $delete;
protected $patch;
public function __construct() {
parent::__construct();
@zachflower
zachflower / hello-world.json
Created November 26, 2015 02:30
Example API Blueprint JSON
{
"element": "category",
"meta": {
"classes": [
"api"
],
"title": "Hello World API"
},
"content": [
{
@zachflower
zachflower / hello-world.md
Created November 26, 2015 02:34
Example API Blueprint Markdown

Hello World API

A Hello World API. Always returns “Hello World”.

Hello World [/hello]

Return “Hello World.” Always.

GET resource [GET]

Make a GET request.

  • Response 200 (text/plain)
@zachflower
zachflower / MY_Model.php
Created May 6, 2013 20:47
Custom CodeIgniter MY_Model
<?php
class MY_Model extends CI_Model{
/**
* The table name
*
* @var string
* @access protected
*/
protected $table = '';
@zachflower
zachflower / migration.php
Created August 13, 2013 01:01
CodeIgniter Migrations Config File
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Enable/Disable Migrations
|--------------------------------------------------------------------------
|
| Migrations are disabled by default but should be enabled
| whenever you intend to do a schema migration.
|
*/
@zachflower
zachflower / 001_users.php
Created August 13, 2013 01:07
Example CodeIgniter Migration Script
<?php
class Migration_Users extends CI_Migration {
public function up(){
$this->dbforge->add_field("id int(11) unsigned NOT NULL AUTO_INCREMENT");
$this->dbforge->add_field("email varchar(255) NOT NULL DEFAULT ''");
$this->dbforge->add_field("password varchar(255) NOT NULL DEFAULT ''");
$this->dbforge->add_key('id', TRUE);
$this->dbforge->add_key('email');