Skip to content

Instantly share code, notes, and snippets.

View dandrews's full-sized avatar
🏠
Working from home

Dan Andrews dandrews

🏠
Working from home
View GitHub Profile
require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
context "GET index" do
#context "POST create" do
#context "GET show" do
#context "PATCH update" do (or PUT update)
#context "DELETE destroy" do
#context "GET new" do
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@dandrews
dandrews / Spam_Bot
Created February 18, 2015 04:32
Spam Bot
{
{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I
never found any interesting article like yours.
{It's|It is} pretty worth enough for me.
{In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as you did, the {internet|net|web} will be {much more|a
lot more} useful than ever before.|
I {couldn't|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch} your {rss|rss feed} as I {can not|can't} {in finding|find|to
find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service.
Do {you have|you've} any? {Please|Kindly} {allow|permit|let}
Given an input string and a dictionary of words,
segment the input string into a space-separated
sequence of dictionary words if possible. For
example, if the input string is "applepie" and
dictionary contains a standard set of English words,
then we would return the string "apple pie" as output.
http://thenoisychannel.com/2011/08/08/retiring-a-great-interview-problem/
@dandrews
dandrews / -
Last active August 29, 2015 14:06 — forked from jb55/-
; <<>> DiG 9.8.3-P1 <<>> txt jamiehankins.co.uk
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 14302
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 2, ADDITIONAL: 3
;; QUESTION SECTION:
;jamiehankins.co.uk. IN TXT
# Since Mongoid switched to its own driver, many of the mongo API
# (available in mongo-ruby-drive) are missing. This is allows you
# to rename a collection thru command message.
#
# Be aware that the API constantly changes in mongoid
#
# Mongoid (3.1.0), Moped (1.4.2)
class MyModel
include Mongoid::Document

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
# create the template
template = PageOfflineTemplate.new
template.quote = quote
template.pages = quote.build_pages
# Here I render a template with layout to a string then a PDF
pdf = PDFKit.new template.render_to_string(:template=>"quotes/review.html.haml")

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results