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 'digest/md5' | |
module ProfilePhoto | |
def profile_photo(profile) | |
profile.avatar.url(:thumb).present? ? profile.avatar.url(:thumb) : "http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(profile.owner.email)}?d=mm" | |
end | |
end | |
# in your application_helper use: | |
# module ApplicationHelper |
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
| myHost myPath | | |
"setup" | |
myHost := 'rmod.lille.inria.fr'. | |
myPath := '/pbe2'. | |
ZnClient new | |
systemPolicy; | |
accept: ZnMimeType textHtml; | |
http; |
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
.pagination { | |
display:inline-block; | |
form { | |
display: inline-block; | |
margin:0; | |
select { | |
width:100px; | |
} | |
} | |
} |
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
<!-- | |
This is the HTML portion of the infinite scroll/pagination with Rails and AngularJS tutorial | |
Required libraries for the tutorial and indicated as "Important", | |
together with implementation specific libraries marked as "Optional" | |
--> | |
<!DOCTYPE html> | |
<html> | |
<title>Clips</title> | |
<!-- Important --> |
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
var DOMAIN = 'http://localhost' | |
var PORT = 3000; | |
var DATA_SOURCE = '/clips.json'; | |
// ANGULAR | |
function clips_controller($scope, $http) { | |
$scope.clips = []; | |
// get the data from the API backend | |
$http.get(DOMAIN+":"+PORT+DATA_SOURCE).success(function(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
var html5rocks = {}; | |
var indexedDB = window.indexedDB || window.webkitIndexedDB || | |
window.mozIndexedDB; | |
if ('webkitIndexedDB' in window) { | |
window.IDBTransaction = window.webkitIDBTransaction; | |
window.IDBKeyRange = window.webkitIDBKeyRange; | |
} | |
html5rocks.indexedDB = {}; |
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
(/** | |
* Flotr Defaults | |
*/ | |
Flotr.defaultOptions = { | |
colors: ['#00A8F0', '#C0D800', '#CB4B4B', '#4DA74D', '#9440ED'], //=> The default colorscheme. When there are > 5 series, additional colors are generated. | |
ieBackgroundColor: '#FFFFFF', // Background color for excanvas clipping | |
title: null, // => The graph's title | |
subtitle: null, // => The graph's subtitle | |
shadowSize: 4, // => size of the 'fake' shadow | |
defaultType: null, // => default series type |
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
FieldUpdate.where("created_at < ?", Date.today) |
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
import opencv | |
#this is important for capturing/displaying images | |
from opencv import highgui | |
import pygame | |
import sys | |
camera = highgui.cvCreateCameraCapture(0) | |
def get_image(): | |
im = highgui.cvQueryFrame(camera) | |
# Add the line below if you need it (Ubuntu 8.04+) |
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
validate :check_dimensions | |
def check_dimensions | |
temp_file = background_image.queued_for_write[:original] | |
unless temp_file.nil? | |
dimensions = Paperclip::Geometry.from_file(temp_file) | |
width = dimensions.width | |
height = dimensions.height | |
if width < 800 && height < 600 |