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
/** This example code is designed to quickly deploy an example contract using Remix. | |
* If you have never used Remix, try our example walkthrough: https://docs.chain.link/docs/example-walkthrough | |
* You will need testnet ETH and LINK. | |
* - Kovan ETH faucet: https://faucet.kovan.network/ | |
* - Kovan LINK faucet: https://kovan.chain.link/ | |
*/ | |
pragma solidity ^0.6.0; | |
import "https://raw.githubusercontent.com/smartcontractkit/chainlink/develop/evm-contracts/src/v0.6/ChainlinkClient.sol"; |
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
pragma solidity ^0.6.0; | |
import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol"; | |
contract CoinGeckoConsumer is ChainlinkClient { | |
address private oracle; | |
bytes32 private jobId; | |
uint256 private fee; | |
uint256 public ethereumPrice; |
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
{ | |
"total": 100, | |
"entries": [ | |
{ | |
"title": "Wolf Creek", | |
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", | |
"programType": "series", | |
"images": { | |
"Poster Art": { | |
"url": "https://streamcoimg-a.akamaihd.net/000/128/61/12861-PosterArt-ec32a81986a45eac7e080112075ab466.jpg", |
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
li:before { | |
content: '\b7\a0'; | |
position: absolute; | |
right: 100%; | |
font-size: 20px; | |
} | |
li { | |
list-style:none; | |
position:relative; | |
} |
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
Reference links | |
http://robots.thoughtbot.com/post/22605580334/constrain-yourself | |
https://github.com/hassox/warden/wiki/overview |
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
# config/routes.rb | |
resources :posts, :only => [:index] | |
# post.rb | |
scope :recommended, where(:recommended => true) # having a guess on your db structure | |
scope :recent, order('created_at DESC').limit(10) | |
scope :popular, where(:like_count => true) # again having a guess | |
# app/controllers/posts_controller.rb |
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
# Using formtastic but can easily converted to use standard rails form helpers | |
= semantic_form_for [ @user ] do |f| | |
= f.semantic_fields_for :user_specialities do |user_speciality| | |
= user_speciality.inputs do | |
= user_speciality.input :speciality_id, :as => :hidden | |
= user_speciality.input :_destroy, :label => user_speciality.object.speciality.name, :as => :boolean, :checked_value => 0, :unchecked_value => 1, :input_html => { checked: !user_speciality.object.new_record? } |
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
#!/usr/bin/env ruby | |
require 'highline/import' | |
require 'sofa' | |
class NoMatchFoundError < StandardError; end; | |
class EpisodeFile | |
attr_accessor :file, :season, :episode, :extension, :high_def, :valid |
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
# Dynamically define whether a user has a role methods in a nice query language based on User::ROLES | |
# Eg. Can now call user.admin? or user.billing? | |
ROLES.each do |role| | |
method_name = (role + '?').to_sym | |
send :define_method, method_name do | |
self.role == role | |
end | |
end |
NewerOlder