Skip to content

Instantly share code, notes, and snippets.

View kristianfreeman's full-sized avatar
🙃

Kristian Freeman kristianfreeman

🙃
View GitHub Profile
@kristianfreeman
kristianfreeman / download.rb
Last active August 29, 2015 14:02
batch download for nsscreencasts
require 'nokogiri'
require 'open-uri'
# if File.exist?(".env")
# `source .env`
# else
# puts "Couldn't find '.env'. Make sure NS_FEED env. variable is set."
# end
FEED = ENV["NS_FEED"]
- Replace any partial roll of toilet paper with a fresh one
- Gather all signs, placards, ads, offers, ?magazines,? Gideon Bibles, or other marketing materials strewn throughout the room; place in lowest dresser drawer; close (and optionally duct-tape) drawer
- Collect all fake plants, fake art objects, and other distracting kipple; place in closet; close closet door
- On one newly marketing-free surface, prominently place photo of family you miss
- Hang up thing to wear tomorrow; if wrinkled, hang in bathroom with shower running
{{#if confirming}}
<button class="btn btn-danger" {{action 'confirm'}}>Are you sure?</button>
{{else}}
<button class="btn btn-primary" {{action 'startConfirming'}}>{{text}}</button>
{{/if}}
@kristianfreeman
kristianfreeman / capture.rb
Created September 26, 2014 03:42
Downloading NPR "First Listen" albums
require 'nokogiri'
require 'open-uri'
# for url - http://ask.metafilter.com/187877/How-to-download-audio-from-NPR-stream
url = 'http://api.npr.org/query?id=1039&fields=titles,audio,show&sort=assigned&apiKey=MDAzMzQ2MjAyMDEyMzk4MTU1MDg3ZmM3MQ010'
doc = Nokogiri::XML(open(url))
doc.xpath('//mp3').each do |file|
url = file.text.strip
if url.include?("/fl/") && url.include?('.mp3') # Is it a "first listen" mp3?
Index: Makefile.am
===================================================================
--- Makefile.am (revision 14528)
+++ Makefile.am (working copy)
@@ -45,7 +45,7 @@ SUPP_FILES = \
exp-sgcheck.supp \
darwin9.supp darwin9-drd.supp \
darwin10.supp darwin10-drd.supp \
- darwin11.supp darwin12.supp darwin13.supp \
+ darwin11.supp darwin12.supp darwin13.supp darwin14.supp \
@kristianfreeman
kristianfreeman / first.go
Created October 27, 2014 01:33
My very first go function, d'aww
func files(dir string) ([]string, error) {
files, err := ioutil.ReadDir(dir)
if err != nil {
return nil, err
}
filenames := make([]string, 0)
for _, f := range files {
#!/bin/bash
cd ~/Mail
git commit -m "Before sync. $(date +%s)" --allow-empty
git fsck --strict --full
mbsync boxes
rm contents && du -h -d1 >> contents
@kristianfreeman
kristianfreeman / dynamic-row-height-list-view.js
Created December 10, 2014 23:34
implementing dynamic rowHeight per list-view item
// ...
heightForIndex: function(idx){
var entry = this.get('content').objectAt(idx);
if (entry.get('rowHeight')) {
return entry.get('rowHeight');
} else {
return this.rowHeight;
}
},
@kristianfreeman
kristianfreeman / trello-dockBadge.js
Created December 11, 2014 05:17
Due soon Trello dock badge for Fluid.app
// adapted from http://scottnelle.com/414/updated-fluid-app-userscript-for-gmail-unread-count/
window.fluid.dockBadge = '';
setTimeout(updateDockBadge, 3000);
setInterval(updateDockBadge, 15000);
function updateDockBadge() {
var dueSoon = $(".badge.badge-state-due-soon").length || '';
console.log('updating dockBadge to', dueSoon)
window.fluid.dockBadge = dueSoon;
@kristianfreeman
kristianfreeman / list-view-latest.js
Created January 7, 2015 18:06
ember list-view built from source 12/1/14
// ==========================================================================
// Project: Ember ListView
// Copyright: ©2012-2013 Erik Bryn, Yapp Inc., and contributors.
// License: Licensed under MIT license
// Version: 0.0.5
// ==========================================================================
(function(global){
var define, requireModule, require, requirejs;