Skip to content

Instantly share code, notes, and snippets.

Brice M. bricemaurin

Block or report user

Report or block bricemaurin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Google Docs Script
function FBshares(url) {
var jsondata = UrlFetchApp.fetch("http://graph.facebook.com/"+url);
var object = Utilities.jsonParse(jsondata.getContentText());
return object.shares;
}
function Tweets(url) {
var jsondata = UrlFetchApp.fetch("http://urls.api.twitter.com/1/urls/count.json?url="+url);
var object = Utilities.jsonParse(jsondata.getContentText());
return object.count;
View gist:f193ed64ba67b2d0ef68
class Post < ActiveRecord::Base
default_scope order('votes DESC')
belongs_to :user
validates :name, :url, :user, presence: true
validates :name, length: { minimum: 5 }
validates :name.downcase, uniqueness: { case_sensitive: false }
validates :url, format: { with: /\Ahttps?\:\/\/(?:www\.|)?\w+\.\w{2,3}(?:\/\w+)?/, message: "invalid url" }
end
class User < ActiveRecord::Base
You can’t perform that action at this time.