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: | |
# parser = Util::PlistParser.new("#{ENV['HOME']}/.cappconfig") | |
# config_hash = parser.parse! | |
module Util | |
class PlistParser | |
attr_accessor :file | |
DOCTYPE = /280NPLIST;1.0;D;/ |
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
// 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() { |
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 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 |
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
.browser { | |
h3 { | |
margin-bottom: 10px; | |
} | |
ol { | |
@include pie-clearfix; | |
} | |
} |
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
$.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, |
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 CH.Views.PostFormView extends Backbone.View | |
events: | |
"focus #post_title": "focus" | |
initialize: -> | |
$("body").on "click", (event) => @blur(event) | |
focus: -> | |
@$(".post-form-expanded").show() |
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
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) |
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
# 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__ |
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(‘sayHello’, function(name) { | |
return function(name) { | |
alert(‘Hi ‘ + name + ‘!’); | |
} | |
}); |
OlderNewer