Skip to content

Instantly share code, notes, and snippets.

View pomartel's full-sized avatar

Pierre Olivier Martel pomartel

View GitHub Profile
@pomartel
pomartel / variables.py
Created October 11, 2023 13:36
Variables
a = 2
b = 3
print(a+b)
@pomartel
pomartel / gist:6919555
Created October 10, 2013 14:45
Get list of facebook friends that are also using the application
@participants = Participant.where("facebook_uid IN (?)", connected_friends).order('id DESC')
def connected_friends
graph = Koala::Facebook::API.new(get_user_oauth_token)
friends = graph.get_connections("me", "friends", fields: 'installed')
friends.collect do |f|
f["installed"] == true ? f["id"] : nil
end.compact
rescue => e
notify_honeybadger_or_ignore e
@pomartel
pomartel / Counter animation
Created October 10, 2013 13:52
Petit coffeescript pour animer un chiffre de 0 jusqu' à son total
#counter{ data: { total: 143 } } 0
$ ->
if $('#counter').length > 0
animateCounter
animateCounter = ->
current = parseInt($('#counter').text())
if current < $('#counter').data('total')
$('#counter').text(current + 1)
@pomartel
pomartel / facebook_cookie.rb
Created March 8, 2011 22:28
Set a cookie to persist the Facebook canvas session (works with Safari)
@pomartel
pomartel / facebook.rb
Created March 7, 2011 18:34
Rack application that converts the request from a POST to a GET when a signed_request parameter is present in the request. This lets you develop restful Facebook canvas applications.
# You can put this file in your lib directory.
# Don't forget to add 'use Rack::Facebook' in config.ru.
module Rack
class Facebook
def initialize(app)
@app = app
end
def call(env)