Nick Wientge nickw

View sinatra_new_relic_1.rb
1 2 3 4 5 6 7 8 9 10
# server.rb
$: << File.expand_path(File.dirname(__FILE__) + "/../lib")
 
require "sinatra/base"
require "newrelic_rpm"
 
module CrowdHall
class Server < Sinatra::Base
configure do
set :app_file, __FILE__
View votePseudoCode.coffee
1 2 3 4 5 6 7 8 9 10
View
clickVote: (event)->
direction = event.direction
oppositeDirection = if direction is "up" then "down" else "up"
 
if currentUser.hasVoted(@model, direction)
@model.removeVote(direction)
else
if currentUser.hasVoted(@model, oppositeDirection)
@model.removeVote(oppositeDirection)
View voteButtons.coffee
1 2 3 4 5 6 7 8 9
CH.Concerns.Voteable =
 
incrementScore: ->
score = parseInt(@get("score"), 10)
@set "score", score+1
 
decrementScore: ->
score = parseInt(@get("score"), 10)
@set "score", score-1
View gist:4273432
1 2 3 4 5 6 7 8 9
class CH.Views.PostFormView extends Backbone.View
events:
"focus #post_title": "focus"
 
initialize: ->
$("body").on "click", (event) => @blur(event)
 
focus: ->
@$(".post-form-expanded").show()
View jquery.myplugin.coffee
1 2 3 4 5 6 7 8 9 10
$.fn.extend
myplugin: (options) ->
self = $.fn.myplugin
opts = $.extend {}, self.defaultOptions, options
for el in this
self.init el, opts
self.log el if opts.log
 
$.extend $.fn.myplugin,
View gist:2363651
1 2 3 4 5 6 7 8 9
.browser {
h3 {
margin-bottom: 10px;
}
 
ol {
@include pie-clearfix;
}
}
View gist:1043436
1 2 3 4 5 6 7 8 9 10
def viewable_by(user)
# An item is viewable if:
# 1. There are no permissions set
(!self.blocking_enabled? && !self.targeting_enabled?) ||
# 2. OR the user owns the item
(self.user_id == user.id) ||
 
# 3. OR the item is not blocked from the user
View provide_html5.js
1 2 3 4 5 6 7 8 9 10
// Attempt to make a drop-and-forget bunch of scripts that mimick some missing html5 goodies automatically
// Example:
// $(document).ready(function() {
// ProvideHtml5.autofocus()
// ProvideHtml5.datepicker()
// ProvideHtml5.forcenumber()
// })
 
var ProvideHtml5 = {
autofocus = function() {
View PlistParser.rb
1 2 3 4 5 6 7 8 9 10
# USAGE:
# parser = Util::PlistParser.new("#{ENV['HOME']}/.cappconfig")
# config_hash = parser.parse!
 
module Util
class PlistParser
attr_accessor :file
DOCTYPE = /280NPLIST;1.0;D;/
Something went wrong with that request. Please try again.