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
#include <stdio.h> | |
#include <stdlib.h> | |
struct node{ | |
void* data; | |
struct node* next; | |
}; | |
void set_int_value(struct node* node, int val) | |
{ |
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
#include <stdio.h> | |
#include <stdlib.h> | |
struct node{ | |
void* data; | |
struct node* next; | |
}; | |
void set_int_value(struct node* node, int val) | |
{ |
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
void* recursive_fold(struct node* head, void* seed, void*(*fun)(void*, void*)) | |
{ | |
if(!head){ | |
return seed; | |
} | |
else return fun(head->data, recursive_fold(head->next, seed, fun)); | |
} |
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
carcajou@physalis:~$ sudo gem install mechanize | |
Successfully installed mechanize-1.0.0 | |
1 gem installed | |
Installing ri documentation for mechanize-1.0.0... | |
Installing RDoc documentation for mechanize-1.0.0... | |
carcajou@physalis:~$ |
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 'rubygems' | |
require 'net/http' | |
require 'mechanize' | |
require 'cgi' | |
def get_imdb_id_from_name(name) | |
a = Mechanize.new | |
a.get('http://www.imdb.com/find?s=all&q='+CGI.escape(name)) do |page| |
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 'rubygems' | |
require 'mechanize' | |
require 'net/http' | |
require 'cgi' | |
def get_imdb_id_from_name(name) | |
a = Mechanize.new | |
# imdb apparently searches for the ua to avoid crawling | |
a.user_agent_alias = 'Mac Safari' | |
# The URL we're retrieving the information from |
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
--- | |
fr: | |
about: | |
blog_link: "" | |
can_answer: "<p>Bien sûr ! Smartdate a été conçu pour tout le monde, car vous pouvez affiner vos critères de recherche. Des dizaines de milliers de personnes nous rejoignent chaque jour, donc quelles que soient vos préférences, vous pourrez découvrir de nombreux profils qui vous correspondent.</p> <p>Smartdate vous permet de rencontrer des célibataires à travers le monde, et offre aujourd’hui ses services en {{link}}. </p> <p>Que vous soyez à la recherche d'un rendez-vous pour ce soir ou du grand amour, Smartdate sélectionne parmi des millions de personnes les profils qui vous correspondent vraiment.</p>" | |
can_title: "Tout le monde peut-il s'inscrire sur Smartdate ?" | |
feedback_link: remarques | |
increase_answer: "<p>Smartdate met tout en oeuvre pour vous procurer une expérience agréable, fun et sécurisée. </p> <p>Puisqu'il s'agit là d'un des aspects de Smartdate que vous aimez particulièrement, nous voulons que cela reste ainsi et nous vous recommandons de lire |
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 photo_set_helper(photos, row_size=8) | |
quotient, remainder = photos.count.divmod(row_size) | |
capture do | |
- for i in 0..quotient-1 | |
.row | |
- for j in 0..row_size-1 | |
= image_tag @photos[i * row_size + j]["s3_url"], :id => "#{@photos[i * row_size +j]["id"]}" | |
- if remainder > 0 | |
.row | |
- for j in 0..remainder-1 |
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 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]}) |
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.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 |
OlderNewer