Skip to content

Instantly share code, notes, and snippets.

View tbeseda's full-sized avatar
🦬

Taylor Beseda tbeseda

🦬
View GitHub Profile
@tbeseda
tbeseda / commit-msg
Created March 24, 2014 18:26
Append current Rdio track to commit message
#!/usr/bin/ruby
message_file = ARGV[0]
def app_is_running?(app_name)
`ps aux` =~ /#{app_name}/ ? true : false
end
while true
if app_is_running?('Rdio.app')
@tbeseda
tbeseda / keybase.md
Created September 30, 2014 15:45
keybase.md

Keybase proof

I hereby claim:

  • I am tbeseda on github.
  • I am tbeseda (https://keybase.io/tbeseda) on keybase.
  • I have a public key whose fingerprint is 880A 07B8 0FB5 375B 00B3 9C87 D1F7 E2C3 3C5E C513

To claim this, I am signing this object:

@tbeseda
tbeseda / IntentSchema.json
Created June 28, 2015 21:49
Ask Alexa about Secrets in Hearthstone
{
"intents": [
{
"intent": "PlayerClassSecrets",
"slots": [
{
"name": "PlayerClass",
"type": "LITERAL"
}
]
var myJSON = {
foo : 'bar',
lorem : 'ipsum',
bar : 'foo',
ipsum : 'lorem'
}
// commas first
var myJSON = {
foo : 'bar'
javascript:var%20links=document.getElementsByTagName('head')[0].getElementsByTagName('link');for(var%20i=0;i%3Clinks.length;i++){if(links[i].getAttribute('rel')=='apple-touch-icon'){links[i].parentNode.removeChild(links[i])}; break;};var%20s=document.createElement('link');s.setAttribute('rel', 'apple-touch-icon');s.setAttribute('href',prompt('Touch icon URL?','http://'));document.getElementsByTagName('head')%5B0%5D.appendChild(s);void(s);
var player = 'your gamertag';
$.getJSON("http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22http%3A%2F%2Fwww.bungie.net%2FStats%2FReach%2FCareerStats%2Fdefault.aspx%3Fplayer%3D"+player+"%22%20and%20xpath%3D'%2F%2Fspan%5B%40id%3D%22ctl00_mainContent_kdLabel%22%5D'&format=json&diagnostics=true&callback=?", function(data){
var kdr = data.query.results.span.content;
alert('My Halo Reach Kill/Death ration is:' + kdr);
});
<?
// get a quote for digest email signature... o_O
$ch = curl_init('http://iheartquotes.com/api/v1/random?source=art&max_lines=2');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
curl_close($ch);
list($quote) = explode('[', $output);
// yeah, that just happened...
?>
@tbeseda
tbeseda / GoogleSite_incrementPage.js
Created October 27, 2010 20:37
Google App Script incrementPage creates a new subpage of a specified page that has a title of the next increment
function incrementPage(parentURL, pageHTML) {
var parentPage = SitesApp.getPageByUrl(parentURL)
,childPages = parentPage.getAllDescendants()
,biggest = 1000;
for(i=0; i<childPages.length; i++) {
var currentName = childPages[i].getName();
if(isNaN(currentName))
continue;
+currentName; // make it a number
<?
$host = 'http://api.untappd.com/v1/user_feed/tbeseda?api_key=1234';
$process = curl_init($host);
curl_setopt($process, CURLOPT_USERPWD, 'user:pass');
curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
$return = curl_exec($process);
print_r($return);
?>
@tbeseda
tbeseda / fit.js
Created January 6, 2011 00:09
truncate a string to a set number of chars and add ellipses with respect for non-word characters.
function fit(str, nMaxChars) {
var n = nMaxChars - 1,
strRX = /\s|\.|,/,
tmp_str = str.slice(0, n),
final_str;
if (str.length <= n) return str;
function getLastChar(str) {
return str.slice(str.length-1, str.length);