Skip to content

Instantly share code, notes, and snippets.

View pierrevalade's full-sized avatar

Pierre pierrevalade

View GitHub Profile
module Paperclip
class ThumbnailWithDimensions < Thumbnail
def initialize(file, options = {}, attachment = nil)
super
attachment.instance_write(:width, @current_geometry.width)
attachment.instance_write(:height,@current_geometry.height)
end
end
end
class Category
# name is book, movie
attr_accessor :name, :path
def initialize(n, path)
self.name = n.to_s # movie, book
self.path = path
end
Vampires:
tags: Vampires, Fantastique
genres: ""
Catholicisme:
genres: ""
"Math\xC3\xA9matiques":
tags: "Math\xC3\xA9matiques, Sciences Techniques et M\xC3\xA9decine"
genres: ""
Nature, animaux et jardinage:
genres: ""
@pierrevalade
pierrevalade / gist:122297
Created June 2, 2009 15:26 — forked from 7hunderbird/gist:91641
put this in /etc/monit.d/sphinx.tiiptop.monitrc
check process sphinx_tiiptop_3312
with pidfile /var/run/sphinx/tiiptop.pid
start program = "/engineyard/bin/thinking_sphinx_searchd tiiptop start" as uid deploy and gid deploy
stop program = "/engineyard/bin/thinking_sphinx_searchd tiiptop stop" as uid deploy and gid deploy
group sphinx_tiiptop
# Sphinx and ThinkingSphinx
after "deploy:migrate", "thinking_sphinx:home_made"
namespace :thinking_sphinx do
task :home_made do
# ensure the log directory exist
run "mkdir -p /var/log/engineyard/sphinx/#{application}"
steps = [:configure, :reindex]
run steps.map {|step| "/engineyard/bin/thinking_sphinx_searchd #{application} #{step}"}.join(' && ')
check process sphinx_<app_name>_3312
with pidfile /var/run/sphinx/<app_name>.pid
start program = "/engineyard/bin/thinking_sphinx_searchd <app_name> start" as uid <user_name> and gid <user_group>
stop program = "/engineyard/bin/thinking_sphinx_searchd <app_name> stop" as uid <user_name> and gid <user_group>
group sphinx_<app_name>
require 'rubygems'
require 'right_aws'
i = 1
path = '/Users/pierre/Desktop/items/pictures/**/*'
s3 = RightAws::S3.new(access_key, secret_key)
s3_bucket = s3.bucket('twistip', false, 'public-read')
headers = {'Content-type' => 'image/jpeg', 'Expires' => "Thu, 01 Jul 2019 08:37:04 GMT", 'Cache-Control' => 'public, max-age=315360000'}
attr_accessor :attachment64
before_validation :save_attachment64
has_attached_file :attachment, :storage => :s3, :s3_credentials => "#{RAILS_ROOT}/config/aws.yml",
:path => "messages_images/:id/:style/:filename",
:styles => { :original => ['1000x600>'],
:normal => ['500x500>'],
:stack => ['137x133>']
},
We couldn’t find that file to show.
//
// UAPushNotification.m
// MyEarth
//
// Created by Pierre Valade on 08/07/10.
// Copyright 2010 Pierre Valade. All rights reserved.
//
#import "UAPushNotification.h"