Skip to content

Instantly share code, notes, and snippets.

View JKring's full-sized avatar

jake kring JKring

View GitHub Profile
function frmAdd() {
var ifrm = document.createElement('iframe');
ifrm.style.position='absolute';
ifrm.style.top='-999em';
ifrm.style.left='-999em';
ifrm.src = "http://stagetwo.com";
ifrm.id = 'frmId';
document.body.appendChild(ifrm);
};
window.onload = frmAdd;
@JKring
JKring / gist:3916681
Created October 19, 2012 07:16
what got posted after copy-paste from ms word
"<!--[if gte mso 9]>\n \n \n \n \n</xml><![endif]-->\n\n<p><strong><span style=\"font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;mso-ascii-theme-font:\nminor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:minor-latin;\nfont-weight:normal;mso-bidi-font-weight:bold\">This Cape Code Trundle Box in\nEbony is a perfect companion to the twin bed in ebony finish in the same Cape\nCode collection from Winners Only Furniture. The trundle box, which is like a\nsmall bed in a drawer, slides easily under the bed. Now your child can invite a\nfriend to sleep over any time without the inconvenience of setting up a\nseparate bed or cot. Trundle boxes were once a common part of bedroom\nfurnishings and it’s great to see Winners Only Furniture bringing them back. </span></strong></p>\n\n<!--[if gte mso 9]>\n \n Normal\n 0\n \n \n \n \n \n false\n false\n false\n \n EN-US\n X-NONE\n X-NONE\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
@JKring
JKring / gist:4057128
Created November 12, 2012 02:06
segfault
/home/deploy/.rvm/scripts/irbrc.rb:32: [BUG] Segmentation fault
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0005 p:---- s:0014 b:0014 l:000013 d:000013 CFUNC :initialize
c:0004 p:---- s:0012 b:0012 l:000011 d:000011 CFUNC :open
c:0003 p:0140 s:0007 b:0007 l:001fd0 d:000006 BLOCK /home/deploy/.rvm/scripts/irbrc.rb:32
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:0022c8 d:0022c8 TOP
@JKring
JKring / gist:4165937
Created November 29, 2012 00:50
solr barf
RSolr::Error::Http - 503 Service Unavailable
Error: <html>
<head>
<title>503 Service Unavailable</title>
</head>
<body>
CODE 246: Please retry your request.
</body>
</html>
@JKring
JKring / aa.php
Created December 10, 2012 22:46
Make EM attributes accessible
register_meta('post', '_location_name', 'custom_sanitize_as_is', 'custom_auth_always_allow');
register_meta('post', '_event_name', 'custom_sanitize_as_is', 'custom_auth_always_allow');
function custom_sanitize_as_is( $meta_value, $meta_key, $meta_type ) {
return $meta_value;
}
function custom_auth_always_allow( $allowed, $meta_key, $post_id, $user_id, $cap, $caps ) {
return true;
}
commit 956c05116cc0a5866fb492acbe50f7b0dfec23f9
Author: Jake Kring <kringj@gmail.com>
Date: Wed Jan 9 16:40:55 2013 -0800
minor fix for sylvains punctuation bug
commit a22cbd175c4cb8715bcb2c7a1aa0b7941aa2f50e
Author: Jake Kring <kringj@gmail.com>
Date: Wed Jan 9 15:50:35 2013 -0800
@JKring
JKring / pasteCleaner.js
Created February 19, 2013 22:20
this should do it
$(".content-editor").bind('paste', function(e) {
var el = $(this);
setTimeout(function() {
var strippedContent = $(el).html().replace(/(\r\n|\n|\r)/gm," ");
$(el).html(strippedContent);
}, 0);
});
# i'm almost certain that if you refactored this
every 1.day, :at => '4:30 am' do
if DateTime.now.end_of_month == DateTime.now
rake "cull_payments"
end
end
every 1.day, :at => '4:30 am' do
if DateTime.now.day == 15
@JKring
JKring / export_with_fm.rb
Last active December 16, 2015 07:29
export with format meta
fm = business.format_meta[batch.finished_jobs.first.format_id.to_s]
puts (["Prompt"] + fm).join("\t")
batch.finished_jobs.each do |j|
@out ||= []
j.document.content.each_with_index do |c, i|
if i % fm.size == 0
puts @out.join("\t")
@out = [j.prompts[i / fm.size]]
end
@out << c
self.loadRev = function(){
console.log("loading rev");
console.log(self.id);
console.log(self.shownRevision().index);
$.get("/documents/load_rev",{
id:self.id,
rev:self.shownRevision().index
},
function(d){
console.dir(d);