This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ... | |
def get_pages | |
# get an array of pages whose source filename contains .html | |
@pages = sitemap.resources.find_all { |page| page.source_file.match(/\.html/) } | |
# sort them by an arbitrary YAML frontmatter property called 'order' | |
@pages.sort! { |a,b| a.data['order'].to_i <=> b.data['order'].to_i } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var usage = 'Usage: node sum.js val1 val2 [other_vals]'; | |
var nums = process.argv.slice(2); | |
var sum = 0; | |
// as a simple program | |
console.log(nums); | |
if (nums.length < 2) { | |
console.log(usage); |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# make sure octokit and highline are actually installed first | |
require 'octokit' | |
require 'highline/import' | |
login = ask("Enter your login: ") { |q| q.echo = false } | |
pass = ask("Enter your pass: ") { |q| q.echo = false } | |
@client = Octokit::Client.new(:login => login, :password => pass) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Views.ListItem = Marionette.ItemView.extend({ | |
template: 'item', | |
tagName: 'li', | |
className: 'gt-result', | |
initialize: function() { | |
// THIS | |
this.listenTo(this.model, 'change', this.render); | |
this.listenTo(this.model, 'change', this.renderShape); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
L.Tooltip.prototype.updatePosition = function(latlng) { | |
var pos = this._map.latLngToLayerPoint(latlng); | |
L.DomUtil.setPosition(this._container, pos); | |
this._container.style.display = 'inline-block'; | |
console.log('doing something'); | |
return this; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Usage: Just include this script after Marionette and Handlebars loading | |
IF you use require.js add script to shim and describe it in the requirements | |
*/ | |
(function(Handlebars, Marionette) { | |
Marionette.Handlebars = { | |
path: 'templates/', | |
extension: '.handlebars' | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define([], function(){ | |
return { | |
// check if an object is a geometry | |
isGeometry: function(object){ | |
return object.isInstanceOf(esri.geometry.Geometry); | |
}, | |
// check if an object is a graphic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* - - - - - - - - - person Bubbles - - - - - - - */ | |
.person { | |
height: 50px; | |
position: absolute; | |
width: 50px; | |
} | |
.portrait { | |
border: 4px solid #fff; | |
border-radius: 50%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
[...] | |
private | |
def switch_to_https | |
return if Rails.env.development? || | |
request.ssl? || | |
request.protocol.include?('https') || |