Skip to content

Instantly share code, notes, and snippets.

Dean Radcliffe deanius

View GitHub Profile
View deanhtml5-intro.md

Get started with the deanhtml5 generator

  • Install node v 10 or greater (Tried NVM ?? )
  • Install NPM, run npm install -g yeoman
  • Run npm install -g generator-deanhtml5
  • Make a directory and in it run yo deanhtml5
  • Give the app a title, and answer any other prompts
  • Begin to fiddle with the app and tests

You now have an HTML5 app, which needs no back end process to run it but:

@deanius
deanius / update_system.sh
Last active Aug 29, 2015
Keep Systems Up to date
View update_system.sh
xcode-select --install
@deanius
deanius / morning_routine.sh
Last active Aug 29, 2015
A cup of morning Comment Sense
View morning_routine.sh
# let your comment-sense dir be PWD
set -e # abort on error
echo "Good morning. Updating projects..."
git checkout master
git pull
bundle install
rake db:migrate
RAILS_ENV=test rake db:migrate
echo "Yay all is good"
@deanius
deanius / bracket_balancer.rb
Last active Aug 29, 2015
4clojure #177 - Bracket Balancer
View bracket_balancer.rb
#!/usr/bin/ruby
# Solution by Dean Radcliffe to 4clojure problem #177
# Disclaimer: not production-ready
# Strategy: Build a tree from parens. Return tree as truthy value, else nil
# TODO clojurify this
require 'ostruct' #convenient hash-like data structure
require 'pp' #pretty printer (optional)
def closer? char
@deanius
deanius / update gems.md
Last active Aug 29, 2015
Updating Gems checklist
View update gems.md
  • Git pull and all tests pass
  • Run bundle outdated > gem_outdated

For a given gem to update:

  • Do a dependency report gem dependency -R GEMNAME

  • Delete the version specifier in Gemfile

  • Run bundle install

  • Commit Gemfile and Gemfile.lock

  • Optionally do gem cleanup on your system

View k-sets.rb
def ksets s=[1,2,3], k=s.size
s.inject([[]]) do |acc, v|
acc + acc.map{|exist| [v] + exist}
end.select{|s| s.length == k}
end
@deanius
deanius / kcomb.clj
Created Apr 18, 2014
K-sets clojure explorations
View kcomb.clj
;; Anything you type in here will be executed
;; immediately with the results shown on the
;; right.
(defn kcomb [k vect]
(cond
(= k 0) '(())
(empty? vect) '()
:else (concat (map
#(cons (first vect) %)
@deanius
deanius / requirejs.coffee
Created Apr 27, 2014
Alternate requirejs syntax
View requirejs.coffee
# TL;DR: Instead of a verb-oriented 'define' function with anonymous arguments, a
# 'descriptive' function with named arguments
#
module deps:[‘a’, ‘b’], factory:(a, b)->
# compare with
define ['a', 'b'], (a, b) ->
# module 'BlahBlah', deps:[‘a’, ‘b’], factory:(a, b)->
@deanius
deanius / min-triangle-path.clj
Last active Aug 29, 2015
4clojure problem 79
View min-triangle-path.clj
; thanks to @eigenhombre i was reminded that we can only take "plinko" paths
; also props for introducing me to letfn
;
; this is what led to the insight that a vector becomes 2 possible vectors
; much like the branching universe theory, and we must mapcat those as we go !
; Key insight
; You branch in predictable way like the game of PLINKO on The Price is Right :)
; Eg at each step, the branches multiply thusly:
; ([0 0]) becomes ([0 0 0] [0 0 1])
View -
diff --git a/test/spec/test_reactive.coffee b/test/spec/test_reactive.coffee
index c8cd535..fac783e 100644
--- a/test/spec/test_reactive.coffee
+++ b/test/spec/test_reactive.coffee
@@ -561,9 +561,11 @@ describe 'RawHtml', ->
).toThrow()
describe 'rxt', ->
- it 'should take as contents (arrays of) strings, elements, RawHtml, or $', ->
+ it 'should take as contents (arrays of) numbers, strings, elements, RawHtml, $ or null', ->
You can’t perform that action at this time.