Skip to content

Instantly share code, notes, and snippets.

View ungoldman's full-sized avatar
🤔
💭

Nate Goldman ungoldman

🤔
💭
View GitHub Profile
@ungoldman
ungoldman / mustachify.js
Created October 18, 2012 00:47
mustachify function for zenircbot ??
js add mustachify function(msg){ var result = /^mustachify (http.*)/.exec(msg.message); if (result) return 'http://mustachify.me/?src=' + result[1] }
@ungoldman
ungoldman / example.html
Created October 25, 2012 20:52
jQuery click bind switch example
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<a href="#" class="button">hi</a>
nope
@ungoldman
ungoldman / application_controller.rb
Created February 21, 2013 21:24
force_ssl replacement method
class ApplicationController < ActionController::Base
[...]
private
def switch_to_https
return if Rails.env.development? ||
request.ssl? ||
request.protocol.include?('https') ||
@ungoldman
ungoldman / person.css
Created March 21, 2013 18:34
gist with a twist
/* - - - - - - - - - person Bubbles - - - - - - - */
.person {
height: 50px;
position: absolute;
width: 50px;
}
.portrait {
border: 4px solid #fff;
border-radius: 50%;
@ungoldman
ungoldman / spatialReference.js
Created June 1, 2013 21:35
ArcGIS JS spatial reference helpers
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
/**
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'
};
@ungoldman
ungoldman / leaflet.tooltip.override.js
Created July 24, 2013 22:14
how to override a leaflet method
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;
}
@ungoldman
ungoldman / view.js
Created July 26, 2013 17:58
bind marionette view to model changes
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);
},
@ungoldman
ungoldman / github.rb
Created August 20, 2013 21:34
learn you an octokit!
# 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)