Skip to content

Instantly share code, notes, and snippets.

View bunnymatic's full-sized avatar
💭
writing computer programs

Mr Rogers bunnymatic

💭
writing computer programs
View GitHub Profile
@bunnymatic
bunnymatic / CSS animate a delete button.markdown
Created July 31, 2015 23:56
CSS animate a delete button
@bunnymatic
bunnymatic / a.md
Last active August 29, 2015 14:16 — forked from shamus/a.md

Communication between collaborating Directives

Directives man! While the they're literally the entry point into angular development (you can't get going without ng-app), many people starting out with Angular are hesistant to write their own because of the complexity associated with them. But once that initial hurdle is crossed their value as reusable components becomes indispensible.

Occasionally a complicated component will come along, one

@bunnymatic
bunnymatic / index.html
Created November 21, 2014 22:31
html with jquery and lodash
<html>
<head>
</head>
<body>
</body>
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
</html>
@bunnymatic
bunnymatic / Gemfile
Last active August 29, 2015 14:05
git bumper playtime
source "https://rubygems.org"
gem 'git'
@bunnymatic
bunnymatic / gist:a78deb0e3274af571916
Created July 9, 2014 15:32
who done it - git blame statistics
Hop into a shell and to the root directory of your project and run
git ls-tree --name-only -z -r HEAD -- $1 | xargs -0 -n1 git blame --line-porcelain | grep "^author "|sort|uniq -c|sort -nr
Then wait a bit. You get a nice sorted list of lines of code and author name.
Add it to your bash profile like this
whodunit() {
git ls-tree --name-only -z -r HEAD -- $1 | xargs -0 -n1 git blame --line-porcelain | grep "^author "|sort|uniq -c|sort -nr
}
@bunnymatic
bunnymatic / clock.js
Last active August 29, 2015 13:57
cordova clock
SummitClock = {
twoDigits: function(v) {
return ("0" + v).slice(-2);
},
updateTime: function() {
var c = document.getElementById('clock');
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var secs = now.getSeconds();
@bunnymatic
bunnymatic / myproject_s3.rb
Created February 28, 2014 16:28
Build signed read url for s3/aws access outside of the aws-sdk#url_for which doesn't like filenames with w/spaces
module MyProject
class S3
def config
Rails.application.config.s3_config
end
def url_for_read(path, opts)
expire_date = (Time.zone.now + opts[:expires]).to_i
request_string = "GET\n\n\n#{expire_date}\n/#{config[:bucket]}/#{path}"
hmac = OpenSSL::HMAC.digest(digest, config[:secret_access_key], request_string)
@bunnymatic
bunnymatic / container.html
Last active August 29, 2015 13:56
js flash plugin
<div id="fixture">
<div class="container">
</div>
<div class="container">
</div>
</div>
__from_exercism_config() {
COMPREPLY=()
local cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=($(compgen -W 'current demo fetch login logout peek restore submit unsubmit whoami help' -- $cur))
}
complete -F __from_exercism_config -o default exercism
@bunnymatic
bunnymatic / hot_stuff-1.rb
Last active January 2, 2016 03:49
active_model_conversion blog post assets
# the hot stuff wrapper/presenter
class HotStuff
def items
@items ||= Stuff.hot.limit(5)
end
end