Skip to content

Instantly share code, notes, and snippets.

View bfillmer's full-sized avatar

Bryan Fillmer bfillmer

View GitHub Profile
@etrepat
etrepat / FIle.sublime-settings.json
Created October 15, 2011 18:44
Sublime Text 2 - My Settings
{
// Sets the colors used within the text area
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
// Note that the font_face and font_size are overriden in the platform
// specific settings file, for example, "Base File (Linux).sublime-settings".
// Because of this, setting them here will have no effect: you must set them
// in your User File Preferences.
"font_face": "Monaco",
"font_size": 12,
@cam-gists
cam-gists / Generic CodeIgniter Model
Created July 13, 2012 21:37 — forked from timmahoney/Generic CodeIgniter Model
Codeigniter: PHP: Table Model
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Generic CodeIgniter Database Model - One table version
*
* Set your Database table and table fields at the top,
* and screw creating models for interfacing with one table.
*
* Disclaimer: I'll answer questions or whatever, but I'm creating
* this to speed my own development up. I hope it helps, but it's not supported.
@iwek
iwek / find-in-json.js
Created October 20, 2012 21:43
Searching through JSON
//return an array of objects according to key, value, or key and value matching
function getObjects(obj, key, val) {
var objects = [];
for (var i in obj) {
if (!obj.hasOwnProperty(i)) continue;
if (typeof obj[i] == 'object') {
objects = objects.concat(getObjects(obj[i], key, val));
} else
//if key matches and value matches or if key matches and value is not passed (eliminating the case where key matches but passed value does not)
if (i == key && obj[i] == val || i == key && val == '') { //
<?php
/**
* @file
* Default theme implementation to display the basic html structure of a single
* Drupal page.
*
* Variables:
* - $css: An array of CSS files for the current page.
* - $language: (object) The language the site is being displayed in.
@lucasstark
lucasstark / gist:6594983
Created September 17, 2013 14:21
Example to add meta data to woocommerce cart items
<?php
/*
* Plugin Name: Example Modify Price
*/
class Example_Modify_Price {
private static $instance;
public static function register() {
if (self::$instance == null) {
@jakobloekke
jakobloekke / ng sprintf filter
Created November 4, 2013 14:25
Angularjs sprintf-style filter for interpolating text with values.
app.filter('sprintf', function() {
function parse(str) {
var args = [].slice.call(arguments, 1),
i = 0;
return str.replace(/%s/g, function() {
return args[i++];
});
}
@DrewAPicture
DrewAPicture / Gruntfile.js
Last active January 1, 2016 17:18
Grunt and package.json files for (in this example) packaging a theme for release. This should get you started -- plenty of Gruntjs resources out there.
// This assumes you've already installed Node.js and any related dependencies.
// 1. Drop this and package.json into your theme root
// 2. Run: npm install
// 3. Run: grunt
// 4. ??????
// 5. Profit
module.exports = function ( grunt ) {
grunt.initConfig( {
@SteveBenner
SteveBenner / unbrew.rb
Last active November 6, 2024 04:35
Homebrew uninstall script
#!/usr/bin/env ruby
#
# CLI tool for locating and removing a Homebrew installation
# http://brew.sh/
#
# Copyright (C) 2014 Stephen C. Benner
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
@bennadel
bennadel / pattern.htm
Created August 25, 2014 11:49
Creating A Reusable Timer In AngularJS
<script type="text/javascript">
function prepareToDoSomething() {
if ( timer ) {
clearTimeout( timer );
}
@ericelliott
ericelliott / defaults-overrides.md
Last active May 7, 2023 13:52
ES6 defaults / overrides pattern

ES6 Defaults / Overrides Pattern

Combine default parameters and destructuring for a compact version of the defaults / overrides pattern.

function foo ({
    bar = 'no',
    baz = 'works!'
  } = {}) {