This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#get the attribute from a given url (image) by using OCR | |
def ocr_attribute url | |
dir = "/tmp/scrapers" | |
file = rand(36**10).to_s(36) | |
path = "#{dir}/#{file}" | |
pnm_path = "#{dir}/#{file}.pnm" | |
open(url) do |f| | |
Dir.mkdir(dir) if !File.exists? dir | |
image = Image.from_blob(f.read)[0] | |
image.write(path) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/redcarpet.rb | |
module ActionView | |
module Template::Handlers | |
class Markdown | |
class_attribute :default_format | |
self.default_format = Mime::HTML | |
def call(template) | |
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true, :space_after_headers => true) | |
markdown.render(template.source).html_safe.inspect |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
class Story | |
attr_accessor :title, :url | |
def initialize(title, url) | |
@title = title | |
@url = url | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var user = { | |
validateCredentials: function (username, password) { | |
return ( | |
(!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' } | |
: (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' } | |
: (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' } | |
: (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' } | |
: (!/^([a-z0-9-_]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' } | |
: false | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ActionDispatch::Routing::Mapper | |
def draw(routes_name) | |
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb"))) | |
end | |
end | |
BCX::Application.routes.draw do | |
draw :api | |
draw :account | |
draw :session |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function guidGenerator() { | |
var S4 = function() { | |
return (((1+Math.random())*0x10000)|0).toString(16).substring(1); | |
}; | |
return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4()); | |
} | |
// How to use it: | |
guidGenerator(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<area shape="poly" class="zones" href="#" data-nearby-zones="787,741,740,728,781" id="742" coords="387,331,388,361,381,371,369,376,365,391,352,398,349,410,324,419,321,413,318,412,316,400,311,401,306,384,324,324,338,332" /> | |
<area shape="poly" class="zones" href="#" data-nearby-zones="743,745,735,740,742" id="741" coords="252,339,291,325,300,308,324,322,305,382,301,380,252,372" /> | |
<area shape="poly" class="zones" href="#" data-nearby-zones="785,786,744,745,741,787" id="743" coords="231,372,291,381,291,384,286,395,262,409,266,414,260,440,249,438,239,432,231,440,208,455,199,452" /> | |
<area shape="poly" class="zones" href="#" data-nearby-zones="742,741,735,736,738,728" id="740" coords="363,230,366,240,380,260,393,263,392,271,390,275,389,286,385,289,385,294,394,314,389,318,389,330,341,330,326,320,317,250" /> | |
<area shape="poly" class="zones" href="#" data-nearby-zones="745,749,752,736,738,740,741" id="735" coords="222,266,284,264,315,250,322,317,299,305,288,322,252,338,220,309" /> | |
<area shape="poly" class="z |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'hash' | |
require 'active_resource' | |
require 'basecamp' | |
require 'httparty' | |
require 'json' | |
class GithubIssues | |
include HTTParty | |
base_uri "https://api.github.com" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Discovery | |
kickoff → discovery approval | |
Design | |
discovery approval → design approval | |
Development | |
design approval → beta | |
Beta |