Skip to content

Instantly share code, notes, and snippets.

View shad's full-sized avatar

Shad Reynolds shad

View GitHub Profile

NOTE: This document outlines a feature that was never fully tested in the platform, but appears to work (at least for simple cases). Use at your own risk, and test your usages as you do.

Uploading data with BASE

BASE is a very useful thing to know about in data.world. It is set to the dataset where the file was uploaded be default. It can be used in prefixes, or directly in triples using the <..> syntax.

NOTE: Does not currently work for .r2rml files.

@shad
shad / test.js
Last active September 22, 2017 21:05
// this is a function!
function foo(bar) {
return 'baz';
}

Keybase proof

I hereby claim:

  • I am shad on github.
  • I am shadr (https://keybase.io/shadr) on keybase.
  • I have a public key whose fingerprint is 7CBC 5E71 1662 E5AE D322 9809 DC8A 9DF7 BA30 351F

To claim this, I am signing this object:

@shad
shad / Rakefile
Created March 7, 2013 15:46
Simulate a really poor network connection on your mac (with support for pow.cx backend). Ex. If you expect your users to use your app in a place with poor network (like the meat department of your local grocery store), then this is a way for you to test that sort of connection. This is not scientific in anyway, just a guess.
# Simulate a really poor network connection on your mac (with support for pow.cx backend)
namespace :network do
task :status do
sh 'sudo ipfw show'
end
task :bad => [:good] do
# Add a new pipe
sh 'sudo ipfw add pipe 1 all from any to any'
# Configure the pipe to only do 50Kbit/s, with typical delays of 2000ms and 90% packet drop rate!
sh 'sudo ipfw pipe 1 config bw 50Kbit/s delay 2000ms plr 0.9'
@shad
shad / gist:1367540
Created November 15, 2011 16:38
builder.py error
$~/Library/Application\ Support/Titanium/mobilesdk/osx/1.7.5/iphone/builder.py simulator "4.2" "." <MY-APP-ID> "My Cool App" iphone
...lines ommitted...
[INFO] Performing clean build
[ERROR] Error: Traceback (most recent call last):
File "/Users/shad/Library/Application Support/Titanium/mobilesdk/osx/1.7.5/iphone/builder.py", line 1093, in main
recompile = copy_tiapp_properties(project_dir)
File "/Users/shad/Library/Application Support/Titanium/mobilesdk/osx/1.7.5/iphone/builder.py", line 408, in copy_tiapp_properties
shutil.copy(os.path.join(project_dir, 'tiapp.xml'), assets_tiappxml)
@shad
shad / titanium-1.7.3.output
Created October 19, 2011 16:16
What I get when I try to build my app with Titanium 1.7.3
~/Library/Application\ Support/Titanium/mobilesdk/osx/1.7.3/iphone/builder.py simulator "4.2" "." 554UNEM399 "Meal Planning by Food on the Table" iphone | grep -v "^$"
File "/Users/shad/Library/Application Support/Titanium/mobilesdk/osx/1.7.3/iphone/builder.py", line 1325
if command in ['simulator', 'build']:
^
IndentationError: expected an indented block
rake aborted!
Command failed with status (1): [~/Library/Application\ Support/Titanium/mo...]
@shad
shad / app.js
Created March 8, 2011 05:32
Modal + NavGroup + TableView + Complex Rows = Crash
// Log info about the window and memory on close
function logClose(event) {
var closingWindow = event.source;
Ti.API.info('close window (' + closingWindow.title +') : ' + Ti.Platform.availableMemory);
}
// Create a row with a couple of subviews
function createRow(spec) {
var row = Ti.UI.createTableViewRow({
hasChild: true,
className:'foo'
@shad
shad / jquery.setTimeout.js
Created December 15, 2010 03:53
Sometimes, it's useful to quickly set/clear a timeout that's attached to an element.
/*
* setTimeout
*
* Sometimes, we want to set a timeout and associate the timeout with
* an element. This is essential for operations that open menus, popups
* flyovers, etc.
*
* Shad Reynolds
* http://shad.github.com
*/
@shad
shad / better-textmate-rspec-puts.rb
Created March 5, 2010 22:34
An Improved puts for rspec in Textmate.
# Improved "puts" in Textmate's version of rspec
if ENV['TM_MODE'] == 'RSpec'
alias :orig_puts :puts
def puts(str)
str = '[nil]' if str.nil?
str = '' if str.blank?
url, line = caller[0].split(":")
md = caller[0].match(/[\\\/]([^\\\/]*:\d+):(.*)/)
link_text = md[1]
title = md[2]
@shad
shad / language_codes.js
Created October 13, 2009 15:28
Two letter language codes.
// from http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
(function () {
if (typeof LANGUAGE_CODES === 'undefined') {
window.LANGUAGE_CODES = [
{code:'aa', name:'Afar'},
{code:'ab', name:'Abkhazian'},
{code:'ae', name:'Avestan'},
{code:'af', name:'Afrikaans'},
{code:'ak', name:'Akan'},
{code:'am', name:'Amharic'},