Skip to content

Instantly share code, notes, and snippets.

View JKring's full-sized avatar

jake kring JKring

View GitHub Profile
@JKring
JKring / json.sh
Created May 23, 2013 22:14
trying to update json
Jakes-MacBook-Pro:Scripted jakekring$ bundle install
Fetching gem metadata from http://rubygems.org/.......
You have requested:
json ~> 1.7.7
The bundle currently has json locked at 1.5.5.
Try running `bundle update json`
Jakes-MacBook-Pro:Scripted jakekring$ bundle update json
Fetching gem metadata from http://rubygems.org/.......
Bundler could not find compatible versions for gem "json":
@JKring
JKring / scrollwatcher.js
Created May 15, 2013 23:25
fun scrolly time
var BUFFER = $(window).height() - $("#box").height();
$(window).scroll(function(){
$(window).scrollTop() > BUFFER ? $("#box").hide() : $("#box").show();
});
@JKring
JKring / issue.py
Created May 10, 2013 21:07
import issue
Traceback (most recent call last):
File "starter.py", line 31, in <module>
seed()
File "starter.py", line 25, in seed
flat_docs = load_flat_docs('jobs.txt')
File "starter.py", line 14, in load_flat_docs
return [ruby_to_python(doc) for doc in open(filename).readlines()]
File "starter.py", line 10, in ruby_to_python
python_dict = eval(sub)
File "<string>", line 1
@JKring
JKring / wtfoneflare.rb
Last active December 17, 2015 04:29
GIST OF TEH DAY
b.finished_jobs.where(id: { "$nin" => ids }).each do |j|
d = j.document
puts "scripted.com/documents/show/#{ d.id }"
d.save_file("Cleaned Up")
@new_c = []
d.content.each do |c|
begin
c.gsub!("\n", " ")
c.strip!
@splitup = c.split(">")
@JKring
JKring / rectify_prescreen_payments.rb
Created May 8, 2013 00:36
this was to rectify mislabeled prescreen payments
misc_writers = Hash.new(0)
adj_writers = []
b.finished_jobs.each do |f|
p = Payment.where("prescreened_jobs.#{ f.id }" => {"$ne" => nil }).first
if p
unless p.prescreened_jobs[f.id.to_s] == 15
if p.paid
current_p = Payment.current(p.writer)
adding = (15 - p.prescreened_jobs[f.id.to_s])
current_p.misc += adding
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);
@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
# 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 / 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);
});
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