Skip to content

Instantly share code, notes, and snippets.

View paulschreiber's full-sized avatar

Paul Schreiber paulschreiber

View GitHub Profile
@dtbaker
dtbaker / gist:da02576c021646cd97d7
Created January 7, 2015 01:23
boutique_line shortcode
<?php
/**
* Class dtbaker_Shortcode_Line
* handles the creation of [boutique_line] shortcode
* adds a button in MCE editor allowing easy creation of shortcode
* creates a wordpress view representing this shortcode in the editor
* edit/delete button on wp view as well makes for easy shortcode managements.
* Author: dtbaker@gmail.com
* Copyright 2014
@paulcc
paulcc / meta_search_hacks.rb
Created December 6, 2010 11:31
Import this to get searchlogic-style scopes from metasearch and rails 3
# by Paul Callaghan, Nov 2010.
# this uses method-missing to trigger generation and execution of the corresponding relation
# eg Product.name_equals("yay")
# TODO: M_S doesn't check for unexpected values, eg match failures in
# matches_attribute_method (so we trap exceptions)
module MetaSearchHacks
def self.build_rel(base_or_scope, method, *args)
@tonsV2
tonsV2 / add_devise_columns_to_user.rb
Created February 9, 2011 01:47
Rails migration for adding devise columns to an existing user model
class AddDeviseColumnsToUser < ActiveRecord::Migration
def self.up
change_table :users do |t|
#if you already have a email column comment the below line
t.database_authenticatable
t.confirmable
t.recoverable
t.rememberable
t.trackable
t.string :encrypted_password, :limit => 128
@nickcatal
nickcatal / disqus.js
Created June 14, 2013 04:32
#NN13 Google Analytics Example Snippets
// Disqus Tracking
/*
Put <div id="disqus_thread"></div> above
*/
var disqus_shortname = 'yourfuckingpollingplace'; // required: replace example with your forum shortname
function track_disqus(comment) {
_gaq.push(['_trackEvent', 'Disqus', 'Comment', document.title]);
};
@grahamgilbert
grahamgilbert / base64_plist.py
Created September 5, 2016 11:03
Writing a base64 encoded string into a plist
#!/usr/bin/python
import base64
import plistlib
import errno
import os
def mkdir_p(path):
try:
os.makedirs(path)
@GaryJones
GaryJones / .jscsrc
Last active November 2, 2018 19:49
JSCS config file
{
"requireSpacesInConditionalExpression": true,
"requireSpacesInFunction": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInFunction": {
"beforeOpeningRoundBrace": true
},
"requireMultipleVarDecl": "onevar",
"requireSpacesInsideObjectBrackets": "all",
@imnotbob
imnotbob / intesis_connect.groovy
Created April 5, 2020 01:03
IntesisHome for Hubitat
/**
* IntesisHome Connect
*
* Author: ERS
* based off device work by Martin Blomgren
* Last update: 2019-12-14
*
* Licensed under the Apache License, Version 2.0 (the 'License'); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at:
@loonies
loonies / pubsub.js
Created October 11, 2012 14:23
jQuery pub/sub plugin by Peter Higgins
/*!
* jQuery pub/sub plugin by Peter Higgins
* https://github.com/phiggins42/bloody-jquery-plugins/blob/master/pubsub.js
*
* Modified by Tobin Bradley
*
* AFL/BSD Licensed
*/
;(function(d){
// the topic/subscription hash
@proofek
proofek / pre-receive
Created June 2, 2011 14:21
pre-receive git hook to run php linter
#!/usr/bin/php
<?php
echo "\nRunning php linter...\n";
$params = explode(' ', file_get_contents('php://stdin'));
$ref = trim($params[1]);
$diff = array();
$return = 0;
@thomasgriffin
thomasgriffin / gist:4953041
Created February 14, 2013 14:04
My gift to you this Valentine's Day. Rendering custom attachment fields in the new media manager via Backbone.
/**
* The code below renders additional custom attachment fields into the
* new media manager.
*
* I am assuming you are using your own custom media modal frame. By
* extending the default Attachment.Details subview, we can append our
* custom fields to the default fields listed.
*
* In the initialize function, we ensure that our changes are always up
* to date by "listening" to our model's change event and updating the