Skip to content

Instantly share code, notes, and snippets.

View dyba's full-sized avatar

M. Daniel Dyba dyba

View GitHub Profile
@dyba
dyba / application.html.haml
Created November 1, 2011 02:35
Jasmine YML file
!!! 5
%html
%head
%title TESTAPP
= stylesheet_link_tag "application"
= javascript_include_tag "application", "registration"
= csrf_meta_tag
%body
%header
%h1#logo
@dyba
dyba / HelloWorld.sol
Created July 31, 2018 16:29
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
pragma solidity ^0.4.24;
contract HelloWorld {
}
@dyba
dyba / cis-194-spring-2017-err1.txt
Created June 26, 2018 16:02
cis-194-spring-2017 Error when running tests
stack build && stack runghc test/Homework/Week01Spec.hs -v
Version 1.7.1, Git revision 681c800873816c022739ca7ed14755e85a579565 (5807 commits) x86_64 hpack-0.28.2
2018-06-26 08:59:58.695588: [debug] Checking for project config at: /Users/ddyba/Code/haskell-cis-194-spring-2017/stack.yaml
@(src/Stack/Config.hs:850:9)
2018-06-26 08:59:58.696816: [debug] Loading project config file stack.yaml
@(src/Stack/Config.hs:876:13)
2018-06-26 08:59:58.699047: [debug] Decoding build plan from: /Users/ddyba/.stack/build-plan/lts-5.3.yaml
@(src/Stack/Snapshot.hs:164:5)
2018-06-26 08:59:58.699139: [debug] Trying to decode /Users/ddyba/.stack/build-plan-cache/lts-5.3.cache
@(src/Stack/Snapshot.hs:156:32)
@dyba
dyba / xcode_shortcuts.txt
Last active December 22, 2015 00:39
A list of Xcode shortcuts
# Movement
OPT + CMD + ] => Move a line up
OPT + CMD + [ => Move a line down
CMD + SHIFT + ] => Move one tab to the right
CMD + SHIFT + [ => Move one tab to the left
CMD + -> / CTRL + E => Move to the end of the line
CMD + <- / CTRL + A => Move to the start of the line
OPT + -> => Move forward one word
OPT + <- => Move backward one word
CTRL + -> => Move forward one word (can move by words inside of camelcased words)
@dyba
dyba / 03FA7FC4-9EC4-4213-BE67-E3CF372599E6.codesnippet
Created August 29, 2013 23:12
Kiwi Spec Starter Code Snippet plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDECodeSnippetCompletionPrefix</key>
<string>kspec</string>
<key>IDECodeSnippetCompletionScopes</key>
<array>
<string>All</string>
</array>
@dyba
dyba / 1.7-improving-sqrt.scm
Last active December 9, 2015 23:59
SICP 1.7 Solution
(define (good-enough? guess next-guess)
(< (/ (abs (- guess next-guess)) guess) 0.001))
(define (average x y)
(/ (+ x y) 2))
(define (improve guess x)
(average guess (/ x guess)))
(define (sqrt-iter guess x)
@dyba
dyba / gist:4197857
Created December 3, 2012 20:42 — forked from halgari/gist:4195378
Atom refactoring
(defn update-my-atom [a name]
(let [new-state (assoc-in @a [:foo :bar] (merge {:name name}))]
(swap! a (fn [old] new-state))))
;; refactored into:
(defn get-new-state [state name]
(assoc-in state [:foo :bar] (merge {:name name})))
@dyba
dyba / example.clj
Created December 3, 2012 16:49
Maintaining State in Clojure
(defn ^:private progress-input-stream
[^java.io.InputStream input-stream size]
(let [total-read (atom 0)]
(proxy [java.io.InputStream] []
(available []
(.available input-stream))
(close []
(.close input-stream))
(read
([]
@dyba
dyba / movie.rb
Created August 6, 2012 05:41
Testing a class method
class Movie < ActiveRecord::Base
def self.all_ratings
# debugger
find_by_sql("SELECT DISTINCT rating FROM movies").map(&:rating)
end
end
@dyba
dyba / application_helper.rb
Created August 1, 2012 03:04
Testing a helper method with a minimalist approach
module ApplicationHelper
def highlight_tag_if(condition, tag, &block)
if condition
content_tag tag, :class => 'hilite', &block
else
content_tag tag, &block
end
end
end