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 ApplicationController < ActionController::Base | |
before_filter :auth_from_cookie | |
def auth_from_cookie | |
@current_user = User.find_by_remember_token(cookies[:remember]) || User.new | |
@current_user.remember_me! if @current_user.new_record? | |
cookies[:remember] = { :value => @current_user.remember_token, :expires => 1.year.from_now } | |
end | |
end |
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
require 'abstract_unit' | |
require 'active_model' | |
class Author | |
extend ActiveModel::Naming | |
include ActiveModel::Conversion | |
attr_reader :id | |
def save; @id = 1 end | |
def new_record?; @id.nil? end |
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
$('script[data-observe="true"]').each(function (index, e) { | |
var el = $(e); | |
observed = $('#' + $(e).attr('data-observed')); | |
frequency = el.attr('data-frequency') ? el.attr('data-frequency') : 10, | |
value = observed[0].tagName.toUpperCase() === 'FORM' ? observed.serialize() : observed.val(); | |
setInterval(function() { | |
var event = new jQuery.Event('periodical'), | |
newValue = observed[0].tagName.toUpperCase() === 'FORM' ? observed.serialize() : observed.val(); | |
event.target = e; |
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
fs.open(filename, 'r', 444, function (err, fd) { | |
res.sendHeader(200, { | |
'Content-Type' : content_type, | |
'Content-Length': stats.size, | |
'Last-Modified' : stats.mtime.toUTCString() | |
}); | |
// TODO: refactor to make more DRY | |
function round(val) { | |
return Math.round(val*Math.pow(10,2))/Math.pow(10,2); |
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
DEBUG: { connection: | |
{ readyState: 'open' | |
, fd: 7 | |
, remoteAddress: '127.0.0.1' | |
, server: { _events: [Object] } | |
, _events: | |
{ end: [Object] | |
, messageBegin: [Object] | |
, url: [Object] | |
, headerField: [Object] |
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
<html> | |
<head> | |
<script src="jquery-1.4.2.min.js"></script> | |
<script src="rails.js"></script> | |
<script> | |
$("#test").live("ajax:complete", function() { | |
$("#result").append("completed<br/>"); | |
}); | |
$("#test").live("submit", function() { | |
$("#result").append("submitting<br/>"); |
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
$("#new_resource").live("ajax:success", function(event, data, status, xhr) { | |
$("#resource_list").html(data); | |
}); |
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
<?php | |
App::import('Core', 'Controller'); | |
App::import('Component', 'Email'); | |
class CoregShell extends Shell{ | |
private $Controller; | |
private $Email; | |
public $uses = array('AffiliateCampaign'); |
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
jQuery(function($) { | |
$("#search").live('keyup', function() { | |
var search_phrase = $(this).val(); | |
var form = $("#licensees_search"); | |
if(search_phrase.length > 3) { | |
$.ajax({ | |
url: form.attr('action'), | |
data: form.serialize(), | |
success: function(data, status, xhr) { | |
$("#licensees").html(data); |
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
$(function() { | |
$('#element').appendTo('#container'); | |
}); |
OlderNewer