Skip to content

Instantly share code, notes, and snippets.

View jejacks0n's full-sized avatar
🕴️
doing things and stuff.

Jeremy Jackson jejacks0n

🕴️
doing things and stuff.
  • Denver, CO
View GitHub Profile
var positive = [
'http://foo.com/blah_blah',
'http://foo.com/blah_blah/',
'http://foo.com/blah_blah_(wikipedia)',
'http://foo.com/blah_blah_(wikipedia)_(again)',
'http://www.example.com/wpstyle/?p=364',
'https://www.example.com/foo/?bar=baz&inga=42&quux',
'http://✪df.ws/123',
'http://userid:password@example.com:8080',
'http://userid:password@example.com:8080/',
<p>Date of last revision: December 22, 2010.<br><br>This policy contains nine sections, and you can jump to each by selecting the links below:<br><b><br>1. Introduction<br>2. Information We Receive<br>3.&nbsp;<span class="Apple-style-span"><b>Sharing information on Facebook</b></span><br>4. Information You Share With Third Parties<br>5. How We Use Your Information<br>6. How We Share Information<br>7. How You Can Change or Remove Information<br>8. How We Protect Information<br>9. Other Terms<br><br></b><strong>1. Introduction</strong><br><br><strong>Questions.</strong>&nbsp;If you have any questions or concerns about our privacy policy, contact our privacy team through this&nbsp;<a href="http://www.facebook.com/help/contact.php?show_form=privacy_policy_general">help page</a>. You may also contact us by mail at 1601 S. California Avenue, Palo Alto, CA 94304.<br><br><strong>TRUSTe Program.</strong>&nbsp;Facebook has been awarded TRUSTe's Privacy Seal signifying that this privacy policy and practices have been re
@jejacks0n
jejacks0n / gist:1072870
Created July 8, 2011 21:30
Creating content with Mercury by overriding save.
new Mercury.PageEditor('/path/to/your/controller');
Mercury.PageEditor.prototype.save = function() {
jQuery.ajax(this.saveUrl, {
type: 'POST',
data: {content: jQuery.toJSON(this.serialize()), _method: 'put'},
success: function() { Mercury.changes = false },
error: function() { alert("Mercury was unable to save to the url: " + this.saveUrl) }
});
}
@jejacks0n
jejacks0n / gist:990160
Created May 25, 2011 01:40
Adding sprockets to evergreen for rails 3.1 and coffeescript (via /config/evergreen.rb)
# For Rails 3.1 asset packaging / sprockets support
# 1. Create a /config/evergreen.rb file and put these contents in it
# 2. Adjust the paths below (the provided ones are generic)
require ::File.expand_path('../application', __FILE__)
module Evergreen
class << self
def application_with_additions(suite)
app = application_without_additions(suite)
// original javascript
String.prototype.singleDiff = function(that) {
var diff = '';
var thatLength = that.length;
for (var i = 0; i < thatLength; ++i) {
if (this[i] != that[i]) {
var regExEscape = this.substr(i).regExEscape().replace(/^\s+|^(&nbsp;)+/g, '');
var re = new RegExp(regExEscape + '$', 'm');
diff = that.substr(i).replace(re, '');
break;
class NewArray extends Array
constructor: ->
super
toString: ->
'aaaaaaaaaaaaaaaaaa'
------------
# The following allows us to have a nested directory structure of specs. With
# a lot of specs this is needed.
module Evergreen
class Suite
def specs
Dir.glob(File.join(root, Evergreen.spec_dir, '**', '*_spec.{js,coffee}')).map do |path|
Spec.new(self, path.gsub(File.join(root), ''))
end
end
// version 1: working, but not providing what's being sent
// we need to have full posts come through so rails can get the info
xhr.open(this.method, this.action, true);
xhr.setRequestHeader('Accept', 'text/javascript, text/html, application/xml, text/xml, */*');
xhr.setRequestHeader('Content-Type', 'multipart/form-data');
xhr.setRequestHeader('X-Version', '1');
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.setRequestHeader('X-CSRF-Token', this.token);
xhr.setRequestHeader("X-File-Name", this.file.name);
xhr.setRequestHeader("X-File-Size", this.file.size);
<script type="text/javascript">
window['midas_setup_container'] = function() {
$('midas_container_selector').childElements().each(function(element) {
Event.observe(element, 'click', function(event) {
event.stop();
this.execute('insertHTML', {action:'insertHTML', value: '<div class="' + element.getAttribute('data-class') + '"><br/></div>'});
}.bind(this));
}.bind(this));
}
</script>
require 'rack'
module Middleware
class Jammit
ROOT = '/app/javascripts'
def initialize(app, options = {})
@app = app
@file_server = ::Rack::File.new(Protosite::Engine.root)
end