Skip to content

Instantly share code, notes, and snippets.

Ryan Mathews ryanjm

Block or report user

Report or block ryanjm

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
@ryanjm
ryanjm / application.controller.js
Created Oct 14, 2015
Testing Sorted Properties
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
sortProperties: ['position'],
sorted: Ember.computed.sort('model', 'sortProperties'),
actions: {
upPosition(m) {
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
View keybase.md

Keybase proof

I hereby claim:

  • I am ryanjm on github.
  • I am ryanjm (https://keybase.io/ryanjm) on keybase.
  • I have a public key whose fingerprint is 77EC FDF8 8283 E0B4 085C 518A 98E7 BF7A 2B88 B73E

To claim this, I am signing this object:

@ryanjm
ryanjm / arrayLastObjects
Created May 9, 2015
Swift Extension for Array
View arrayLastObjects
extension Array {
// Underscore is to opt out of Swift forcing an external name for
// the default property.
func lastObjects(_ c:Int = 1) -> Array? {
if (c == 0) {
return Array()
}
else if (c < 0) {
return nil
}
View gist:9794401

Test

  • Click the Setup tab: It is located in the menu bar and will only be accessible to Administrators.
  • Click the Setup tab: It is located in the menu bar and will only be accessible to Administrators.
View KMLTest.html
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>KML Test</title>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script type="text/javascript" charset="utf-8">
// this is a function to be called when the page has loaded. In Rails we'll be using jQuery and this will be a little different
@ryanjm
ryanjm / gist:4279976
Created Dec 13, 2012
For lightening talk
View gist:4279976
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Evented Programming</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8">
View index.html
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Index</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<style type="text/css" media="all">
.container { width: 960px; margin: 0 auto; }
.item { height: 30px; }
</style>
View small.csv
# opens file
f = File.new('small.csv','r')
# grab all the lines (array)
lines = f.readlines
# header will be first line, take it out and strip white space
headers = lines.shift.strip
keys = headers.split(',')
# value to hold presidents
presidents = []
# loop over remaining lines
@ryanjm
ryanjm / gist:2999736
Created Jun 26, 2012
A little lesson in ruby methods
View gist:2999736

Methods in ruby have a special feature if the last attribute is a hash

def dashed_keys(h1, h2)
  "h1(#{ h1.keys.join("-") }) h2(#{ h2.keys.join("-") })"
end

> dashed_keys({:a => 1, :b => 2}, {:m => 13, :n => 14})
=> "h1(a-b) h2(m-n)"
You can’t perform that action at this time.