Skip to content

Instantly share code, notes, and snippets.

View tylor's full-sized avatar

Tylor Sherman tylor

View GitHub Profile
@tylor
tylor / package.json
Created March 2, 2014 05:11
Scrape the CrossFit Open 2014 Results and create a CSV
{
"name": "xf-games-open-14-scrape",
"version": "0.0.0",
"license": "MIT",
"dependencies": {
"request": "~2.34.0",
"cheerio": "~0.13.1",
"async": "~0.2.10"
}
}
@tylor
tylor / gist:e1ebf330dd4d1797d6a6
Last active August 29, 2015 14:03
EAST VAN logo generator in bash
VAN=`egrep -i "^...$" /usr/share/dict/words | perl -MList::Util=shuffle -e "print shuffle<STDIN>" | head -n 1 | tr "[:lower:]" "[:upper:]"` && \
LETTER=${VAN:1:1} && \
EAST=`egrep -i "^.${LETTER}..$" /usr/share/dict/words | perl -MList::Util=shuffle -e "print shuffle<STDIN>" | head -n 1 | tr "[:lower:]" "[:upper:]"` && \
echo " ${EAST:0:1}" && \
echo $VAN && \
echo " ${EAST:2:1}" && \
echo " ${EAST:3:1}"
@tylor
tylor / gist:dfb1a9b4fc40db80935a
Last active August 29, 2015 14:05
Such sign in
I always forget I'm signed in with my personal GMail account, and want
to access our businesses Google Analytics, so here's what happens:
1. Load up http://www.google.com/analytics/
2. Click 'Access Google Analytics'
3. Woops, wrong account. Click 'Sign out'
4. Choose business account
5. Enter password
6. Takes me to 'Personal Info - Account Settings'
7. Load up http://www.google.com/analytics/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Plaintext Passwords</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#password').keyup(function() {
$('#plaintext').text($('#password').val());
});
Ruby bitwise swap:
a = 10
b = 3
print (a ^ b ^ a), "\n" # 3
print (b ^ a ^ b), "\n" # 10
PHP bitwise swap:
71579 photos * (2592 * 1944 px) * (2.4 inches/sqrt(240^2 + 320^2)) = 2164054206 inches = 54967 km = 1.4 times around the Earth
Number of public Flickr photos * Nokia N82 camera resolution * Nokia N82 screen pixel density
So, if you were to line up the pixels from Roland's camera next to each other and display them on a Nokia N82 screen, they would circle the Earth 1.4 times.
@tylor
tylor / searchlight_graphael_hbar_support.patch
Created May 12, 2011 18:35
Give yhahn/searchlight_graphael horizontal bar charts, depends on http://drupal.org/node/1155710
diff --git plugins/searchlight_graphael_box.inc plugins/searchlight_graphael_box.inc
index 60116c1..34394c9 100644
--- plugins/searchlight_graphael_box.inc
+++ plugins/searchlight_graphael_box.inc
@@ -30,6 +30,7 @@ class searchlight_graphael_box extends boxes_box {
'#options' => array(
'pie' => t('Pie'),
'bar' => t('Bar'),
+ 'hbar' => t('Horizontal Bar'),
'line' => t('Line'),
@tylor
tylor / gather.js
Created September 6, 2011 21:29
Log Translink bus data
/**
* Quick and dirty snippet to log bus information provided by Translink mobile pages like: http://nb.translink.ca/StopMap/50322
* Run using: $ node gather.js > log.js
*/
var exec = require('child_process').exec;
var last;
// Grab the ASP.NET_SessionId from a browser cookie.
var session = '...';
@tylor
tylor / multilingual_box.inc
Created October 9, 2011 04:00
Extend boxes box, implement hook_boxes_plugins().
<?php
/**
* Simple custom text box.
*/
class multilingual_box extends boxes_box {
/**
* Implementation of boxes_content::options_defaults().
*/
public function options_defaults() {
@tylor
tylor / README.txt
Created October 25, 2011 19:20
JSLint validation in Textmate
Quick and dirty JSLint validator for Textmate:
1. Install node and npm
2. Install jslint module: npm install -g jslint
3. Create a new command named jslint for Javascript in the Bundle Editor
- Input: 'Entire Document'
- Output: 'Show as Tool Tip'
- Activation: Key Equivalent, something like Command+j
- Command(s), probably have to change your node path: