Skip to content

Instantly share code, notes, and snippets.

View joshstrange's full-sized avatar

Josh Strange joshstrange

View GitHub Profile
@joshstrange
joshstrange / gist:2046413
Created March 15, 2012 19:50
Add Translation icon to edit page
var elems = document.getElementsByTagName('a'),
i;
for (i in elems) {
if ((" " + elems[i].parentNode.className + " ").indexOf(" views-field-edit-node ") > -1) {
var url = elems[i].href;
var re1 = '.*?';
var re2 = '(node)';
var re3 = '(\\/)';
var re4 = '(\\d+)';
var re5 = '(\\/)';
@joshstrange
joshstrange / TiMobileHelp
Created March 20, 2012 20:19
Debug Code
var icons = [
{
title:"News",
icon: 'images/icon_news_'+settings.iconSize.str+'.png',
content: 'news.js'
},
{
title:"Articles",
icon: 'images/icon_articles_'+settings.iconSize.str+'.png',
content: 'articles.js'
@joshstrange
joshstrange / beanstalk-hooks.php
Created March 26, 2012 16:27
Pre/Post beanstalk hooks
define('API_KEY', '[YOUR KEY]');
define('API_SEC', '[YOUR SECRET]');
define('YOUR_EMAIL', '[YOUR EMAIL]');
if (!function_exists('curl_init')) {
trigger_error('CURL must be enabled for boxcar_api to function', E_USER_ERROR);
}
// load the api class
require_once 'boxcar_api.php';
gem install macgap
@joshstrange
joshstrange / config.xml
Created July 6, 2012 12:59
FileConveyor Config.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<!-- Sources -->
<sources ignoredDirs="CVS:.svn">
<source name="drupal" scanPath="/var/www/www.domain.com" documentRoot="/var/www" basePath="/www.domain.com/" />
</sources>
<!-- Servers -->
<servers>
<server name="cloudfiles" transporter="mosso">
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
var self = this;
var self.seenRobots = {};
self.aim = function(robot, target) {
console.log('My: '+robot.position.x+','+robot.position.y);
console.log('Target: '+target.position.x);
console.log('Angle'+robot.cannonAbsoluteAngle)

Keybase proof

I hereby claim:

  • I am joshstrange on github.
  • I am joshstrange (https://keybase.io/joshstrange) on keybase.
  • I have a public key whose fingerprint is 31A0 80EF C5F1 61CF 5DC6 ADD6 894A 22E4 58B5 B0D3

To claim this, I am signing this object:

@joshstrange
joshstrange / QuickAndDirtySearchController.js
Created April 28, 2014 20:48
A very simple full text search for hiding/showing elements on a page that requires jQuery
function QuickAndDirtySearchController(elements, searchBox) {
var instance = this;
instance.elements = elements;
instance.searchBox = searchBox;
instance.elements.each(function(){
var el = $(this);
var text = instance.recursiveText(el);
el.data('searchText', text);
});
@joshstrange
joshstrange / gulpfile.js
Created April 29, 2014 14:08
Gulp example for co-worker
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var uglify = require('gulp-uglify');
var notify = require('gulp-notify');
var rename = require('gulp-rename');
var concat = require('gulp-concat');
var ngmin = require('gulp-ngmin');
var clean = require('gulp-clean');
var less = require('gulp-less');
var minifyCSS = require('gulp-minify-css');
Verifying I am +joshstrange on my passcard. https://onename.com/joshstrange