Skip to content

Instantly share code, notes, and snippets.

@dogweather
dogweather / .gitignore
Created March 29, 2022 03:49 — forked from SunDi3yansyah/.gitignore
Generate Static HTML Website Using Ruby on Rails
# Ignore static version of the site (used to upload error pages to S3 for Heroku errors)
/out
import Data.Semigroup
import Data.Functor
import Control.Applicative
data Validation err a = Failure err | Success a
deriving Show
instance Functor (Validation err) where
fmap f (Success a) = Success (f a)
fmap _ (Failure e) = Failure e
##Create a migration
### rails g migration make_unicode_friendly
class MakeUnicodeFriendly < ActiveRecord::Migration
def change
alter_database_and_tables_charsets "utf8", "utf8_general_ci"
end
private
def alter_database_and_tables_charsets charset = default_charset, collation = default_collation
@dogweather
dogweather / modal.html
Created November 3, 2015 05:18 — forked from andrefe90/modal
<div class= "row">
<div class="header">
<h2 class= "learn-more"> Learn More </h2>
</div>
<div class="modalbutton">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg">Awesomness</button>
</div>
<!-- Large modal -->
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
<div class="modal-dialog modal-lg">
if (5 + 5 == 10)
puts 'this is true'
else
puts 'this is false'
end
@dogweather
dogweather / index.html
Last active August 29, 2015 14:27
Fixed Bootstrap Navbar
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Nik the Nomad</title>
<link href="css/normalize.css" rel="stylesheet">
@dogweather
dogweather / index.html
Last active August 29, 2015 14:25 — forked from Kaiserhaynes/About Me
After using a "beautify" plugin, with the Atom editor
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta charset="Web developer">
<title>About Me</title>
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/styles.css" type="text/css" rel="stylesheet">
@dogweather
dogweather / result
Last active January 6, 2016 21:28 — forked from gilomen2/result
Binary vs. Iterative search with a large data set
mercury:search-test robb$ ruby ./test.rb
user system total real
Binary search: 0.000000 0.000000 0.000000 ( 0.000016)
Iterative search: 0.000000 0.000000 0.000000 ( 0.004715)
Binary search: 0.000000 0.000000 0.000000 ( 0.000010)
Iterative search: 0.010000 0.000000 0.010000 ( 0.006112)
Binary search: 0.000000 0.000000 0.000000 ( 0.000016)
Iterative search: 0.010000 0.000000 0.010000 ( 0.010991)
class Agent < ActiveRecord::Base
validates :first_name, :last_name, :email, presence: true
validates :email, uniqueness: true
has_many :missions
scope :on_assignment, -> { Agent.joins(:missions).where(missions: { status: 'active' }) }
scope :not_on_assignment, -> { where.not(id: Agent.on_assignment.pluck(:id)) }
def name
"#{first_name} #{last_name}"
end
require 'rspec'
describe "Behaviour" do
it "should pass" do
true.should eq true
end
it "should fail" do
true.should eq false
end