This file contains hidden or 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
// | |
// AppDelegate.swift | |
// swift-ios | |
// | |
import Foundation | |
import UIKit | |
import Ably | |
class AppDelegate: NSObject, UIApplicationDelegate, ARTPushRegistererDelegate, UNUserNotificationCenterDelegate { |
This file contains hidden or 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
// add this code as a bookmark and use it on a basecamp project page | |
javascript: if ($('body').find('ul#calculation').length > 0) { | |
var list = $('body').find('ul#calculation'); | |
list.empty(); | |
} else { | |
var list = $('<ul>').attr('id', 'calculation'); | |
$('body').append(list); | |
} |
This file contains hidden or 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 PrimeFinder | |
def initialize | |
@prime_list = [] | |
@prime_sum = 0 | |
end | |
def prime?(number) | |
sqrt = Math.sqrt(number).to_i | |
@prime_list.each do |prime| | |
if prime <= sqrt |
This file contains hidden or 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 authenticates_many(name, options = {}) | |
options[:session_class] ||= name.to_s.classify.constantize | |
options[:relationship_name] ||= options[:session_class].klass_name.underscore.pluralize | |
class_eval <<-"end_eval", __FILE__, __LINE__ | |
def #{name} | |
find_options = #{options[:find_options].inspect} || #{options[:relationship_name]}.scope(:find) | |
find_options.delete_if { |key, value| ![:conditions, :include, :joins].include?(key.to_sym) || value.nil? } | |
@#{name} ||= Authlogic::AuthenticatesMany::Association.new(#{options[:session_class]}, find_options, #{options[:scope_cookies] ? "self.class.model_name.underscore + '_' + self.send(self.class.primary_key).to_s" : "nil"}) | |
end | |
end_eval |