Skip to content

Instantly share code, notes, and snippets.

😀

Devin Rhode devinrhode2

😀
Block or report user

Report or block devinrhode2

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
@devinrhode2
devinrhode2 / foo.html
Created Mar 22, 2014
fe fi fo fum fam for the shenanigans
View foo.html
<script src="lodash.custom.min.js"></script>
<script type="text/javascript">
/*
Example:
_({key: value}).join('=', ';') === 'key=value;'
*/
(function(){
var oldJoin = _.prototype.join;
_.prototype.join = function (colon, comma) {
if ( comma ) {
View gist:11277918
View ProjectEuler.1.rb
leadingMultiple = 0
multiples = {}
# first do multiples of 3:
while leadingMultiple < 1000 do
multiples[leadingMultiple] = :present;
leadingMultiple += 3
end
# reset to zero
View SumEvenFibsLessThan4Milli.2.rb
# Fibonacci sequence
fibs = [1,2]
while (leadingFib = fibs[-1] + fibs[-2]) < 4000000 do
fibs.push(leadingFib)
end
puts fibs.select{ |i| i%2==0 }.inject(:+)
View data-models.markdown

Typical has_many :items, :through => :list_items A MediaItem is a book, audiobook, or video, or any other generic MediaItem A MediaList can be one of two things: a category and a users personal library.

By allowing a MediaItem to know about how many lists it is on, you can track usage and popularity of that MediaItem and show 'tags' representing each category it's in.. so but I think category and a users media collection should both be unique and inherit from MediaList.. could this be polymorphism? So there are 2 types of MediaLists,

# app/models/media_list.rb
class MediaList < ActiveRecord::Base
  has_many :media_list_items
View hourly_wage_calculator.rb
#!/usr/bin/env ruby
loop {
puts "reasonable bay area salary:" #70000
baySalary = baySalary || 70000
baySalary = gets.to_i || baySalary || 70000
puts "reasonable monthly cost for room in bay area:" #750
bayRent = bayRent || 740
bayRent = gets.to_i || bayRent
puts "reasonable monthly cost for room in Eugene: (default 370)"
@devinrhode2
devinrhode2 / ember-pouchdb-differences.md
Last active Aug 29, 2015
Some differences between taras/Ember-PouchDB and nolanlawson/ember-pouch
View ember-pouchdb-differences.md

I figured I would just write this gist in case anybody searches is.

taras/Ember-PouchDB has a more unique api, but I think it passes the ember-data test suite..

nolanlawson/ember-pouch simply makes the ember-data api work with pouch through relational-pouch.

Which one is better? I'm really not sure, but with nolanlawson/ember-pouch, nolan has made the regular ember-data api work with pouch in a pretty clean way. All you do is setup the adapter.

Please comment with more info as I haven't gotten to try out both plugins, I don't know jack lanterns

@devinrhode2
devinrhode2 / inverse-xml-color-strings.js
Last active Aug 29, 2015
modern js to inverse the colors for a textmate/sublime text .tmTheme file
View inverse-xml-color-strings.js
// inverseA is the inverse function from this page but it only returns the newColor: http://www.webmasterorbit.com/rgb-hex-code.html
var text, node;
[].slice.call(document.getElementsByTagName('string'))
.forEach(function(node){
text = node.innerText;
if ( text.indexOf('#') === 0 ) {
node.innerText = '#' + inverseA(text.substring(1, 7) )
}
})
@devinrhode2
devinrhode2 / harsh.md
Created Jan 31, 2015
"What devin is concerned about"
View harsh.md

Wanted to withhold this harsher criticism from this comment: nolanlawson / ember-pouch / pull / 30 #issuecomment-72339191 but wanted to save it, and if someone searches google for "PouchDB security" they can find my more honest opinion:

"Concerned about the fact that you would remove documentation about security on the basis that you don't quite understand it, and not take the initiative to go and learn about it. It would be foolish to assume PouchDB currently has good security if a maintainer doesn't know what CSP is and doesn't take initiative to learn about it."

View tcpick-mac-install.sh
#!/bin/bash
mkdir temp
cd temp
wget http://downloads.sourceforge.net/project/tcpick/tcpick/0.2.1/tcpick-0.2.1.tar.gz
tar zxvf tcpick-0.2.1.tar.gz
cd tcpick-0.2.1
CFLAGS="-m32" ./configure
echo "char *lookup();" >> src/lookup.h
make
sudo make install
You can’t perform that action at this time.