Skip to content

Instantly share code, notes, and snippets.

🐉

Bo Jeanes bjeanes

🐉
Block or report user

Report or block bjeanes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View lifx-sunrise-simulator.rb
require "lifx" # http://rubydoc.info/github/lifx/lifx-gem/master/frames
def calculate_color(i) # 0 <= i <= 1
h = [40 * 2 * i, 40].min # will be 40 (yellow) at i=1/2 and stay there
s = 1.0 - [(i - 0.5) * 2, 0].max # will be 1 until i=1/2 and then go down to 0
b = i
LIFX::Color.hsbk(h, s, b, LIFX::Color::KELVIN_MIN)
end
duration = 30 * 60 # seconds
@bjeanes
bjeanes / README
Last active Dec 30, 2015 — forked from jnbt/repairMKV.sh
Synology-compatible script to repair mkv files
View README
https://forums.plexapp.com/index.php/topic/63691-how-to-automated-linux-script-for-fixing-broken-mkv-files-works-with-sickbeard-too/
View pre-commit.sh
#!/bin/bash
# Author: slowpoke <proxypoke at lavabit dot com>
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.
#
# A pre-commit hook for go projects. In addition to the standard
View 4bo.clj
(defn loud-numbers
[]
(take 10 (iterate (fn [x] (println "I'm adding to " x) (inc x)) 0)))
(defn less-lazy
([coll] (less-lazy coll 1)
([coll how-far]
(lazy-seq
(future (nth coll how-far))
(cons (first coll) (less-lazy (rest coll))))))
View blerg.coffee
window.app = format: {}
app.format.DollarizesCents = ->
dollarize: (pennies) ->
amount = (pennies / 100.0).toFixed(2)
"$#{@commasFor(amount)}"
#private
commasFor: (dollars) ->
View example_its_lets.rb
# This assumes `is_appropriate?` is renamed to `appropriate?` which is more idiomatic anyway
describe FashionSituation do
describe "#is_appropriate?" do
context "when wearing only shorts" do
let(:wearing_only_shorts) { FashionSituation.new(:shirt => false, :shoes => false, :shorts => true, :location => location) }
subject { wearing_only_shorts }
context "at a restaurant" do
let(:location) { "restaurant" }
View scope_steps.rb
When /^(.*) in the "([^\"]*)" section$/ do |action, title|
within "//*[(h1|h2|h3|h4|h5|h6|legend|caption)/descendant-or-self::*[contains(text(), '#{title}')]]" do
When action
end
end
When /^(.*) in the "([^\"]*)" row$/ do |action, title|
within "//*[(th|td)/descendant-or-self::*[contains(text(), '#{title}')]]" do
When action
end
View gist:213775
#!/usr/bin/env ruby
require 'rubygems'
require 'daemons'
Daemons.run_proc('PassengerMonitor') do
command = 'sudo passenger-memory-stats'
memory_limit = 250
View gist:89037
There are many like it.
View snippet.sh
function parse_git_deleted {
[[ $(git status | grep deleted:) != "" ]] && echo "-"
}
function parse_git_added {
[[ $(git status | grep "Untracked files:") != "" ]] && echo '+'
}
function parse_git_modified {
[[ $(git status | grep modified:) != "" ]] && echo "*"
}
function parse_git_dirty {
You can’t perform that action at this time.