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
import Foundation | |
// A lens is a getter and a setter combined | |
struct Lens<Whole, Part> { | |
let get: (Whole) -> Part | |
let set: (inout Whole, Part) -> () | |
} | |
// We can create a lens from a key path | |
extension Lens { |
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
# encoding: utf-8 | |
require "rails_erd/diagram" | |
require "graphviz" | |
require "erb" | |
# Fix bad RegEx test in Ruby-Graphviz. | |
GraphViz::Types::LblString.class_eval do | |
def output # @private :nodoc: | |
if /^<.*>$/m =~ @data | |
@data |
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
<% if options.orientation == :vertical %>{<% end %> | |
<table border="0" align="center" cellspacing="0.5" cellpadding="0" width="<%= NODE_WIDTH + 4 %>"> | |
<tr><td align="center" valign="bottom" width="<%= NODE_WIDTH %>"><font face="Arial-BoldMT" point-size="11"><%= entity.name %></font></td></tr> | |
</table> | |
<% if attributes.any? %> | |
| | |
<table border="0" align="left" cellspacing="2" cellpadding="0" width="<%= NODE_WIDTH + 4 %>"> | |
<% attributes.each do |attribute| %> | |
<tr><td align="left" width="<%= NODE_WIDTH %>" port="<%= attribute %>"><%= attribute %> <font face="Arial-ItalicMT" color="grey60"><%= attribute.type_description %></font></td></tr> | |
<% 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
/usr/local/bin/appledoc \ | |
--project-name "${PROJECT_NAME}" \ | |
--project-company "HCRUB" \ | |
--company-id "com.hcrub" \ | |
--output "${PROJECT_DIR}/Documentation" \ | |
--install-docset \ | |
--logformat xcode \ | |
--keep-undocumented-objects \ | |
--keep-undocumented-members \ | |
--keep-intermediate-files \ |
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
# switch default editor for pry to sublime text | |
Pry.config.editor = "sublime" | |
# format prompt to be <Rails version>@<ruby version>(<object>)> | |
Pry.config.prompt = proc do |obj, level, _| | |
prompt = "\e[1;30m" | |
prompt << "#{Rails.version} @ " if defined?(Rails) | |
prompt << "#{RUBY_VERSION}" | |
"#{prompt} (#{obj})>\e[0m" | |
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
function fedex12(p_tracking_number varchar2) return boolean is | |
trk varchar2(12); | |
tot number:=0; | |
mult number:=1; | |
chr varchar2(1); | |
begin | |
--if the data passed is 12 digits then strip everything but valid FedEx tracking number characters. | |
if length(p_tracking_number) = 12 then | |
for x in 1..length(p_tracking_number) loop | |
chr := upper(substr(p_tracking_number,x,1)); |
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 AdminToolUser < ActiveRecord::Base | |
# Setup accessible (or protected) attributes for the model | |
attr_accessible :email, :password, :password_confirmation, :remember_me, :first_name, :last_name | |
validates_presence_of :first_name, :last_name | |
# Include default devise modules. Others available are: | |
# :token_authenticatable, :confirmable, :registerable, :lockable and :timeoutable | |
devise :database_authenticatable, :recoverable, :rememberable, :trackable | |
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
// | |
// NSObject+Blocks.h | |
// Filemator | |
// | |
// Created by Zachary Waldowski on 4/12/11. | |
// Copyright 2011 Dizzy Technology. All rights reserved. | |
// | |
@interface NSObject (Blocks) |
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 python | |
# -*- coding: ascii -*- | |
############################################################################## | |
# Copyright (c) 2010, Erik Karulf ([email protected]) | |
# | |
# Permission to use, copy, modify, and/or distribute this software for any | |
# purpose with or without fee is hereby granted, provided that the above | |
# copyright notice and this permission notice appear in all copies. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
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
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
NewerOlder