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
// Copiez votre API key depuis https://platform.openai.com/account/api-keys | |
const SECRET_KEY = ENTER YOUR SECRET KEY HERE; | |
// utile pour éviter de cramer trop de crédits par query. | |
const MAX_TOKENS = 200; | |
// Forké & mis à jour pour supporter GPT3.5 depuis le code de Abi. Suivez Abi sur Twitter: https://twitter.com/_abi_ | |
/** | |
* Completes your prompt with GPT-3 |
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 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 |
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
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; |