I hereby claim:
- I am benshimmin on github.
- I am benshimmin (https://keybase.io/benshimmin) on keybase.
- I have a public key ASBE3mlv4vBeRu2K3_PP63iNCM1RyV2Xx9pwCUI4QT0xSwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
# Assumptions: | |
# 1. $("#pdf-download") is something you can click on (not really required). | |
# 2. $(".result-page") is something in your existing page that you want to turn into a PDF. | |
# 3. You want to add a class of `pdf-rendered` to it and then specify some CSS which applies when that class is added. | |
# 4. Your CSS for `.pdf-rendered` specifies a useful width for a PDF (795px is pretty good) and anything else you like | |
# (this is for portrait ("p") PDFs; obviously you'll need to make a few modifications for landscape PDFs!). | |
# How it works: | |
# 1. Take the requested element in your existing page, clone it, add a "pdf-rendered" class to it, and append to | |
# the body. |
# This might not be the best way, it might be improved in more | |
# recent versions of Rails Admin, but this seems to work okay | |
# for me. | |
class SomeModel < ActiveRecord::Base | |
enum :some_enum => { | |
:some_key => 0 | |
} |
javascript:(function(){Backbone.$("#supercontainer").hide();Backbone.$("body").attr("style", "overflow : visible !important");})(); |
class Foo < ActiveRecord::Base | |
def self.fields(something = false) | |
-> (model) { | |
field :bar | |
field :baz | |
field :woof | |
if something | |
field :something_else |
You need Node, obviously, and JSDom. Then use it like this:
$ ./pathformer.js test.svg > test.out.svg
# A CoffeeScript version of http://norvig.com/spell-correct.html | |
[fs, _] = [require("fs"), require("underscore")] | |
words = (text) -> text.toLowerCase().match /[a-z]+/g | |
train = (features) -> | |
model = {} | |
_.each features, (f) -> if model[f] then model[f] += 1 else model[f] = 1 | |
model |
$(".modal-backdrop, .modal").hide();$("body").css("overflow","auto"); |
#!/usr/bin/env node | |
// This should solve the "Polygon" puzzle in The Times 2 "MindGames". | |
// Assumes a *nix system with the usual dictionary of words in the usual | |
// place. | |
// A few of the rules for what words count are a bit complicated... you could | |
// probably extend this with a Porter Stemmer, if you cared enough. | |
var fs = require("fs"), | |
readline = require("readline"), |
look at love | |
how it tangles | |
with the one fallen in love | |
look at spirit | |
how it fuses with earth | |
giving it new life | |
why are you so busy | |
with this or that or good or bad |