Skip to content

Instantly share code, notes, and snippets.

View stresslimit's full-sized avatar

Colin stresslimit

  • sorry most activity is private...
View GitHub Profile
<html>
<head>
<script src="http://apps.littlebitscloud.cc/api-http/littleBitsAPI.min.js"></script>
<script>
function set_auth(form) {
var v = {
access_token: form.access_token.value,
device_id: form.cloudBit_id.value
}
window.littleBitsAPI = littleBitsAPI.defaults(v)
<?php
$access_token = 'YOUR_TOKEN';
$cloudBit_ID = 'YOUR_CLOUDBIT_ID';
init_api_request($access_token, $cloudBit_ID);
function handle_input($ch, $data) {
// remove "data:" from beginning of SSE data to leave just json
$data = preg_replace('/^data:(.*)$/mi', '$1', $data);
// decode json to get php object
@stresslimit
stresslimit / populate-zendesk-fields.js
Last active February 28, 2024 11:06
Pre-populate Zendesk new ticket fields via query params
jQuery(function($) {
if ( !$('#new_request') ) return
var query = window.location.search.substring(1);
var vars = query.split("&");
var match, fieldID;
for (var i=0; i<vars.length; i++) {
var pair = vars[i].split("=");
match = pair[0].match(/^request_fields\[([a-z_\d]+)\]$/)
if (match) {
@stresslimit
stresslimit / floating-clouds.html
Created April 10, 2014 16:28
Scrolling clouds css animation
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link href="http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
<style>
/* define the floating animation; just a simple position shift */
@keyframes cloud_floating {
@stresslimit
stresslimit / cloudscroll.html
Last active August 29, 2015 13:57
cloud float css anim
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link href="http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
<style>
/* define the floating animation; just a simple position shift */
@-webkit-keyframes cloud_floating {
0% { left: -5%; }
@stresslimit
stresslimit / svn:externals
Created September 6, 2012 19:28
svn propedit svn:externals wp-content/plugins
ajax-thumbnail-rebuild http://plugins.svn.wordpress.org/ajax-thumbnail-rebuild/trunk/
editorial-calendar http://plugins.svn.wordpress.org/editorial-calendar/trunk/
custom-metadata http://plugins.svn.wordpress.org/custom-metadata/trunk/
#email-address-encoder http://plugins.svn.wordpress.org/email-address-encoder/trunk/
#posts-to-posts http://plugins.svn.wordpress.org/posts-to-posts/trunk/
#rich-text-tags http://plugins.svn.wordpress.org/rich-text-tags/trunk/
simple-page-ordering http://plugins.svn.wordpress.org/simple-page-ordering/trunk/
sld-custom-content-and-taxonomies http://plugins.svn.wordpress.org/sld-custom-content-and-taxonomies/trunk/
#taxonomy-terms-order http://plugins.svn.wordpress.org/taxonomy-terms-order/trunk/
#wp-mail-smtp http://plugins.svn.wordpress.org/wp-mail-smtp/trunk/
@stresslimit
stresslimit / .bash_profile
Created July 15, 2012 15:29
useful shortcuts and settings for .bash_profile
# directory listing shortcut
alias ll='ls -la'
# hardening wordpress file permissions shortcuts
alias setpermd='find . -type d -exec chmod 755 {} \;'
alias setpermf='find . -type f -exec chmod 644 {} \;'
# set vi as svn propeditor
export SVN_EDITOR=vi
@stresslimit
stresslimit / gist:2938770
Created June 15, 2012 21:22
Almost working: recursively pre-populate taxonomy terms
add_action( 'init', 'sld_prepopulate' );
function sld_prepopulate() {
$terms = array(
'term1',
'term2',
'Faculty' => array(
'booze',
'jeans',
),
@stresslimit
stresslimit / gist:2931849
Created June 14, 2012 18:03
WordPress: get_posts() grouped by category
<?php
/*
* This class returns you an object that you can foreach() loop through, passing regular
* get_posts() args, and the results will be grouped by category or custom taxonomy.
* It's designed right now to work with posts in only one category [taxonomy term].
*
* Usage:
$args = array(
'taxonomy' => 'my_taxonomy',
@stresslimit
stresslimit / gist:1719681
Created February 1, 2012 21:48
quick WordPress custom URL variables
<?php // quick WordPress custom URL variables for /en/page-name & /fr/page-name
function flush_rewrite() {
flush_rewrite_rules( false );
}
add_action( 'init', 'flush_rewrite' );
function my_insert_query_vars( $vars ) {
array_push( $vars, 'lang' );
return $vars;