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 sign_in | |
params[:return_to] ||= "back" | |
save_return_point | |
if request.post? and perform_login and params[:origin] != 'email_preferences' | |
#report_from_server :category => 'login', # User logged in | |
# :action => 'success', | |
# :label => "user_id=[#{current_user.id}]" | |
redirect_to_return_point | |
elsif request.post? and perform_login and params[:origin] == 'email_preferences' |
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 self.send_all_hourly_notifications | |
sql_condition = <<eos | |
folders.discarded = 0 | |
and users.email_updates = 1 | |
and users.email not in (select email from email_blacklist) | |
and users.invalid_email != 1 | |
and folder_members.frequency = 'hourly' | |
and folder_members.email_updates = 1 | |
and folder_members.discarded = 0 | |
eos |
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
"(users.invalid_email is null\n and users.email_updates = 1\n and users.email_weekly_updates != 1\n and users.email_hourly_updates != 1\n and users.email not in (select email from email_blacklist))" | |
# this works but gives a ReadOnlyRecord error | |
FolderMember.chunky_find(:conditions => where, :joins => "JOIN users ON users.id = user_id") do |member| | |
puts member.id | |
member.frequency = "daily" | |
member.save | |
end | |
# this give an unknown column 'users.invalid_email' error |
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
ActionView::TemplateError: | |
ActionView::TemplateError (undefined method `item' for #<Sale:70341641267180 @id=1063696>) on line #68 of app/views/emails/folders/items_notification.text.html.erb: | |
65: <% case key.to_s | |
66: when "Sale", "Rental" -%> | |
67: <%= | |
68: changes = @entries[key].collect {|entry| entry.item.interesting_changes(@membership.last_notified_at)}.flatten(1).group_by {|change| [change[0], change[1]]} | |
69: changes.collect {|key, values| "#{FormattingHelper.number values.size} #{key[1].downcase}" }.join("<br />") | |
70: %> | |
71: <% when "Building" -%> |
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
desc "Pings PING_URL to keep a dyno alive" | |
task :dyno_ping do | |
require "net/http" | |
uri = URI("YOUR SITE") | |
response = Net::HTTP.get_response(uri) | |
end |
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
angular.module("User", ["ngResource"]) | |
function UserController($scope, $resource) { | |
User = $resource("/users.json") | |
$scope.users = User.query(); | |
$scope.addUser = function() { | |
entry = User.save({name:$scope.newUser.name}) | |
$scope.users.push(entry); | |
$scope.newUser.name = ';' |
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
<div ng-controller="UserController"> | |
<ul> | |
<li ng-repeat="user is users"> | |
{{ user.name }} | |
</li> | |
</ul> | |
<form> | |
<input type="text" ng-model="newUser.name" placeholder="name"> | |
<button ng-click="addUser()">Add User</button><br> | |
<span>{{newUser.name}}</span> |
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 UsersController < ApplicationController | |
respond_to :json | |
def index | |
respond_with User.all | |
end | |
def create | |
respond_with User.create(params[:user]) | |
end |
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
require 'fis/test' | |
include Fis::Test | |
class Dog | |
attr_accessor :name, :species, :colors, :fur_length | |
def initialize(attributes_hash) | |
attributes_hash.each { |k,v| self.send ("#{k}=").to_sym, v } | |
end | |
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
<!DOCTYPE html> | |
<html lang="en-US"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" > | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content ="width=device-width, minimum-scale=1.0, initial-scale=1.0"> | |
<title>The Flatiron School</title> | |
<link rel='stylesheet' href="/css/style.css" type='text/css' media='all' /> |
NewerOlder