Skip to content

Instantly share code, notes, and snippets.

View Veejay's full-sized avatar

Bertrand Chardon Veejay

View GitHub Profile
class PhotosController < ApplicationController
layout "photos"
def moderate
start = PhotoCursor.instance.profile_photos_cursor
@primary = params[:other].blank?
@photos = RemotePhoto.get(:next, :start => start, :limit => PhotoCursor::SET_SIZE, :profile_photo => @primary)
if request.post?
RemotePhoto.put(:bulk_update, {:photos => params[:photos]})
def self.get(primary)
message = (primary ? "profile" : "other") + "_photos_cursor"
self.instance.send(message)
end
def self.put(primary, value)
message = (primary ? "profile" : "other") + "_photos_cursor="
self.instance.send(message, value)
end
class PhotoCursor < ActiveRecord::Base
acts_as_singleton
# How many photos we're displaying at once in the photo moderation tool
SET_SIZE = 30
def self.get(primary)
>> PhotoCursor.put(true, 19)
=> 19
>> PhotoCursor.get(true)
=> 3
>> PhotoCursor.instance
=> #<PhotoCursor profile_photos_cursor: 3, other_photos_cursor: 1, created_at: "2010-08-08 12:40:54", updated_at: "2010-08-08 17:25:55">
>>
#!/bin/zsh
# vim:fdm=marker
#
# .zshrc
#
# by Sylvain Lebresne <lebresne@gmail.com>
#
# Prompt {{{1
module Criterion
@@registered = {}
def self.register(name, &block)
@@registered[name] = block
end
# Returns a boolean indicating if the user passed
# as a parameter satisfies the criterion
module Criterion
@@registered = {}
def self.register(name, &block)
@@registered[name] = block
end
def self.format_age(date)
begin
age = Date.today.year - date.year
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px }
#map_canvas { height: 100% }
</style>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
function initialize(){
with(google.maps){
// Let's query the geocoding service to set the bounds for the map
var myOptions = {
zoom: 8,
mapTypeId: MapTypeId.ROADMAP
};
// The actual map
var map = new Map(document.getElementById("map_canvas"), myOptions);
TAILLE DU TABLEAU D'EMAILS: 40
EMAIL NUMERO 1 ==> ["Name: Christine Langer", "Current Zip code: 02368", "Home Phone: 732-236-8849", "Work Phone: --", "Email: cmlanger@gmail.com", "Contact Preference: No Preference Any Time", "Move Date: 6/1/2011", "Move Weight: 1 Bedroom, 2940 lbs", "Origin: Randolph, Massachusetts 02368", "Destination: Old Bridge, New Jersey ", "Requests and Comments: ", "Date Submitted: 5/27/2011 4:38:11 PM", "search for: Residential Movers", "to the following url http://www.123movers.com/companyflaglead.aspx?cid=679%3E&qid=%3C96%3B%3A9%3A&se=&type=rt%7Bnsl or calling us at 201 944 5900."]
EMAIL NUMERO 2 ==> [" Move Info:\t", " City: \tCambridge\t", " State:\tMA\t", " ZipCode:\t02138\t", " City: \tReading\t", " State:\tMA\t", " ZipCode:\t01867\t", " Type: \tPartial Home\t", " Move Date:\t06/09/2011\t", " Comments:\tI need to move a large, heavy treadmill.\t", " Name:\tPatricia Sullivan\t", " Email:\tprs118@aol.com\t", " Contact Number:\tHome: 617 491 1171 Ext-\t", " Contact Preference:\