Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Request object for handling alternative HTTP requests
*
* Alternative HTTP requests can come from wireless units like mobile phones, palmtop computers,
* and the like. These units have no use for Ajax requests, and this Component can tell how Cake
* should respond to the different needs of a handheld computer and a desktop machine.
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
@connrs
connrs / gist:1855991
Created February 17, 2012 23:09
get dns records!!
dig @primary-nameserver.example.com example.com axfr
PLUGINDIR="$HOME/Library/Application Support/Plex Media Server/Plug-ins"
BUNDLEDIR="$PLUGINDIR/LetMeWatchThis.bundle"
if [ -d "$BUNDLEDIR" ]; then
rm -rf "$BUNDLEDIR"
fi
mkdir "$BUNDLEDIR"
curl -Ls https://github.com/ReallyFuzzy/LetMeWatchThis.bundle/tarball/master 2>&1 | tar xz - --strip-components=1 -C "$BUNDLEDIR/"
@connrs
connrs / qsa-polyfill-ie7.js
Created May 18, 2012 09:49
IE7 querySelectorAll polyfill
if (!document.querySelectorAll) {
document.querySelectorAll = function(selector) {
var doc = document,
head = doc.documentElement.firstChild,
styleTag = doc.createElement('STYLE');
head.appendChild(styleTag);
doc.__qsaels = [];
styleTag.styleSheet.cssText = selector + "{x:expression(document.__qsaels.push(this))}";
window.scrollBy(0, 0);
@connrs
connrs / delay_with_reset.js
Created March 26, 2013 11:52
Callback delay with reset
// I just wanted a quick reference for this function as it's a common pattern
// used when managing DOM events that may fire multiple times in a short period
// of time.
function delayWithReset(delayMilliseconds, callback) {
var timeout = null;
var func = function() {
var args = Array.prototype.slice.apply(arguments);
window.clearTimeout(timeout);
timeout = window.setTimeout(function () {
@connrs
connrs / gist:5860619
Created June 25, 2013 17:48
Ruby Rogues <-> BeyondPod debugging
61:I/ActivityManager( 1991): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=mobi.beyondpod cmp=mobi.beyondpod/.ui.views.Splash bnds=[221,392][319,539] u=0} from pid 2463
77:I/ActivityManager( 1991): START {typ=1b9190fc-7bef-4002-afe7-4e12f6eeb3c1 cmp=mobi.beyondpod/.ui.views.feedsettings.FeedPropertiesView (has extras) u=0} from pid 8492
192:I/ActivityManager( 1991): START {dat=feed://feed/1b9190fc-7bef-4002-afe7-4e12f6eeb3c1 cmp=mobi.beyondpod/.ui.views.FeedContentViewActivity u=0} from pid 8492
219:I/ActivityManager( 1991): START {typ=1b9190fc-7bef-4002-afe7-4e12f6eeb3c1 cmp=mobi.beyondpod/.ui.views.feedsettings.FeedPropertiesView (has extras) u=0} from pid 8492
315:V/BeyondPod( 8492): Repository save started... (34.86 s. since last trace) [FeedRepository]
316:V/BeyondPod( 8492): (3 ms. since last trace) [DownloadAgent]
317:V/BeyondPod( 8492): >> -------------- Download of http://rubyrogues.com/feed started from pos: 0! -------------- (1 ms. since las
@connrs
connrs / ghost
Created February 2, 2014 15:24
Ghost Blog Configuration (Apache, Ubuntu Upstart)
#!/bin/bash
NODE_ENV=production /home/myuser/local/bin/node /home/myuser/www/index.js
@connrs
connrs / keybase.md
Last active August 29, 2015 14:06
keybase.md

Keybase proof

I hereby claim:

  • I am connrs on github.
  • I am connrs (https://keybase.io/connrs) on keybase.
  • I have a public key whose fingerprint is E44C 6877 AC53 6B57 D52C 642B 0F34 2407 81A7 33B9

To claim this, I am signing this object:

program trTriangle;
uses crt;
type triangle = record
len : Array[0..2] of Real;
Scal,Isos,Equi,Obtu,RAng,Refl : Boolean;
end;
var
inTri : triangle;
doneyet : Char;
loop : boolean;
module SqTr where
-- Make a square number
squareNumber :: Integer -> Integer
squareNumber = (^2)
-- Make a triangle numnber
triNumber :: Integer -> Integer
triNumber x = fromIntegral (round (x' * (x' + 1) * 0.5)) :: Integer
where x' = fromInteger x