Skip to content

Instantly share code, notes, and snippets.

View jalbertbowden's full-sized avatar

albert jalbertbowden

View GitHub Profile
@scripting
scripting / copyRiverFiles.js
Last active August 29, 2015 14:21
I run this JavaScript every minute to copy files from a private folder to a public-facing server.
//By Dave Winer, May 12, 2015.
//I use this script to copy the only files that River4 produces that have to be publicly accessible.
//It only copies if the dest file doesn't exist or if the content of the files has changed.
//I use Noderunner to run it once every minute: https://github.com/scripting/noderunner
var sourcefolder = "/root/river4data/rivers/";
@hackwaly
hackwaly / gist:d1c0b43c23cf8e19c8f4
Created May 21, 2015 09:17
A solution for Youtube's pjax problem.

I've noticed that Youtube use pjax for page navigation a long time.

It strongly improved the user experience. But there's a problem not solved: After user click a link. Instead of showing loading progress by browser, the loading progress is showing by Youtube's page. And before target page load complete, user can't cancel the navigation (through browser's Stop command).

Maybe, that's one reason of why Youtube provide a in-page progress bar. Without it, user can't know whether page is navigating or not.

I'll introduce a solution for it (demo). It makes browser show loading status (yes, you can use in-page progress bar same time), and allow user use Stop command cancel navigation.

@evoactivity
evoactivity / Default (OSX).sublime-keymap
Last active August 29, 2015 14:22
Key Bindings to help write well formed css
[
{
"keys": [":"],
"command": "insert",
"args": {"characters": ": "},
"context": [
{
"key": "selector",
"operator":"equal",
"operand":"source.scss"
@sethhall
sethhall / no-cert-parsing.bro
Last active August 29, 2015 14:23
Script to avoid OpenSSL DoS CVE-2015-1788
##! This script is to avoid CVE-2015-1788 which is explained in
##! detail at http://jpb.io. It is a denial of service against
##! OpenSSL which will cause Bro processes to lock up.
##! WARNING - This script should only be used temporarily until
##! your OpenSSL library is upgraded. This script can
##! then be removed.
@if( /2\.3/ in bro_version() )
event file_over_new_connection(f: fa_file, c: connection, is_orig: bool) &priority=-100
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
var CSSMatrix;
if (navigator.userAgent.indexOf("Gecko") !== -1 && navigator.userAgent.indexOf("KHTML") === -1) {
CSSStyleDeclaration.prototype.__defineGetter__("borderRadius",function() {
return this.MozBorderRadius;
});
CSSStyleDeclaration.prototype.__defineSetter__("borderRadius",function(x) {
this.MozBorderRadius = x;
});
CSSStyleDeclaration.prototype.__defineGetter__("userSelect",function() {
<link rel="stylesheet" href="anothersheet.css" type="text/css" charset="utf-8">
<style type="text/css" media="screen">
@font-face {
/* etc */
}
</style>
<!--
The above causes rendering to block in IE6-8 until the external font has downloaded.
So, to avoid blocking in IE:
// ----------------------------------------------------------
// A short snippet for detecting versions of IE:
// Uses a combination of object detection and user-agent
// sniffing.
// ----------------------------------------------------------
// If you're not in IE then:
// ie === NaN // falsy
// If you're in IE then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
@rwenderlich
rwenderlich / import.sql
Created February 15, 2011 00:08
Script for importing Maryland MTA data, based on mheadd's git://gist.github.com/615470.git
-- -------------------------------------------------------------------------------------------------------
-- A SQL script for importing GFTS data from the State of Maryland into a MySQL database.
--
-- Copyright 2010 Mark J. Headd
-- http://www.voiceingov.org
-- Tweaked for Maryland data by Ray Wenderlich
-- http://www.raywenderlich.com
--
-- This file is free software; you can redistribute it and/or modify it under the terms of the
-- GNU Library General Public License as published by the Free Software Foundation; either version 2 of the
@stared
stared / README.md
Last active September 25, 2015 16:33
An Internet Archive Wayback Machine Ad