Skip to content

Instantly share code, notes, and snippets.

View nathanbrauer's full-sized avatar

Nathan J. Brauer nathanbrauer

View GitHub Profile
@nathanbrauer
nathanbrauer / gist:792886
Created January 24, 2011 05:46
This is all the HTML needed for the basic CSShromium 'window'
<ul class="window">
<li class="title"><span class="activeTitle">Loading...</span> &ndash; CSShromium</li>
<li class="page active" data-www="http://www.linkedin.com/in/nathanbrauer" data-hostname="linkedin.com"></li>
<li class="page" data-www="http://github.com/HelloLogic" data-hostname="github.com"></li>
<li class="page" data-www="http://aext.net/author/nathanbrauer/" data-hostname="aext.net"></li>
<li class="menu"><input type="text" value="" disabled="true"/></li>
</ul>
mysql> select * from `Customer` c JOIN (`Order` o) on (c.CustomerID=o.CustomerID) order by c.CustomerID;
+------------+-----------+---------+------------+-----------+
| CustomerID | Name | OrderID | CustomerID | OrderItem |
+------------+-----------+---------+------------+-----------+
| 1 | Nathan | 1 | 1 | boots |
| 2 | James | 5 | 2 | shirt |
| 2 | James | 2 | 2 | socks |
| 3 | Brauer | 6 | 3 | scarf |
| 3 | Brauer | 3 | 3 | pants |
| 4 | The First | 4 | 4 | shorts |
<?php
//Predefined data:
//$Answers = array('1'=>15,'2'=>1,'5'=>21, ..., '1000000000'=>17); //k = answer, v = how many times that answer was chosen
$Question->PossibleAnswers = '{"min":"0","max":"1000000000","default":"2","unit":""}';
$PossibleAnswers = json_decode($Question->PossibleAnswers);
$diff = $PossibleAnswers->max - $PossibleAnswers->min;
$add = ceil($diff/100);
while ($PossibleAnswers->min <= $PossibleAnswers->max) {
@nathanbrauer
nathanbrauer / .htaccess
Created September 27, 2012 19:47
gzip portion of .htaccess
# ----------------------------------------------------------------------
# Gzip compression
# ----------------------------------------------------------------------
<IfModule mod_deflate.c>
# force deflate for mangled headers
# developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
<IfModule mod_setenvif.c>
<!-- first -->
<a onclick="window.location.hash='2MinDemo-WatchOverview';mktoMunchkinFunction('visitWebPage', { url: window.location.href });">...</a>
<!-- last -->
<a onclick="window.location.hash='2MinDemo-SeeWhatWeDo';mktoMunchkinFunction('visitWebPage', { url: window.location.href });">...</a>
@nathanbrauer
nathanbrauer / 1.obscure.js
Last active December 15, 2015 05:29
Obscure data - not a safe way to encrypt data, but useful when you want to bring less attention to the data you're storing.
/**
* 1. Reverse string
* 2. Encode (base36) each character
* 3. Reverse encoding of character (e.g. 2f becomes f2)
* 4. Join each encoded character into a string delimited by "."
* 5. Reverse string
*/
var obscure = function (str) {
if (typeof str !== 'string') return str;
var strEncoded = '', i;
<?php
// Add to framework/model/Image.php
// Ensures all Image URLs have a cachebuster appended so when an image is replaced (same file name), the correct image appears in the browser.
public function getURL() {
$LastEdited = $this->LastEdited;
if (!$LastEdited) {
$Original = File::find($this->getFilename());
if (!$Original || !$Original->LastEdited) return parent::getURL();
<IfModule pagespeed_module>
ModPagespeed off
</IfModule>
Index: filesystem/File.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- framework/filesystem/File.php (revision 8518)
+++ framework/filesystem/File.php (revision 8519)
@@ -640,13 +640,29 @@
}
@nathanbrauer
nathanbrauer / Forms1-onFormSubmit.js
Last active August 29, 2015 13:58
Marketo Forms 1.0 onSubmit Function
function onFormSubmit(callback) {
var oldFormSubmit = window.formSubmit;
window.formSubmit = function(elt) {
if (typeof callback == 'function') callback(elt);
if (typeof oldFormSubmit == 'function') oldFormSubmit(elt);
};
}