Skip to content

Instantly share code, notes, and snippets.

View StupidCodeFactory's full-sized avatar
🏠
Working from home

Yann Marquet StupidCodeFactory

🏠
Working from home
View GitHub Profile

Keybase proof

I hereby claim:

  • I am stupidecodefactory on github.
  • I am yannsilkfred (https://keybase.io/yannsilkfred) on keybase.
  • I have a public key ASAGoM5vIca8G8QYzjgfcITF83ansdBiGbvNbpBbg2s6dQo

To claim this, I am signing this object:

### Keybase proof
I hereby claim:
* I am stupidecodefactory on github.
* I am yannsilkfred (https://keybase.io/yannsilkfred) on keybase.
* I have a public key ASAGoM5vIca8G8QYzjgfcITF83ansdBiGbvNbpBbg2s6dQo
To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am stupidcodefactory on github.
  • I am yann_marquet (https://keybase.io/yann_marquet) on keybase.
  • I have a public key whose fingerprint is 90C2 E7B0 58A3 C1FF DD19 5105 8B9D A7D0 AA71 414A

To claim this, I am signing this object:

@StupidCodeFactory
StupidCodeFactory / og.rb
Last active November 8, 2015 15:35
Optional open graph metadata
module OpenGraphRails
class Og
include ActiveModel::Model
# require metadata
attr_accessor :title, :type, :image, :url
validates_presence_of :title, :type, :image, :url
# optional metadata
attr_accessor :audio, :description, :site_name, :video
# lib/open_graph_rails.rb
require 'open_graph_rails/version'
require 'activemodel'
require 'open_graph_rails/og'
module OpenGraphRails
# Your code goes here...
end
# lib/open_graph_rails/og.rb
module OpenGraphRails
class Og
include ActiveModel::Model
attr_accessor :title, :type, :image, :url
validates_presence_of :title, :type, :image, :url
end
end
require 'spec_helper'
module OpenGraphRails
RSpec.describe OpenGraphRails do
it 'has a version number' do
expect(OpenGraphRails::VERSION).not_to be nil
end
describe Og, type: :model do
@StupidCodeFactory
StupidCodeFactory / gem_example.gemspec
Last active October 27, 2015 01:35
an example gemspec
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'open_graph_rails/version'
Gem::Specification.new do |spec|
spec.name = "open_graph_rails"
spec.version = OpenGraphRails::VERSION
spec.authors = ["Yann Marquet"]
spec.email = ["ymarquet@gmail.com"]
@StupidCodeFactory
StupidCodeFactory / test_dumb.rb
Created October 14, 2015 18:53
add dumb ruby method
def dumb_stuff
if somethin == true
true
else
false
end
end
### R code from vignette source 'Presentation.Rnw'
### Encoding: UTF-8
###################################################
### code chunk number 1: init
###################################################
options(width=60)
###################################################