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 Page | |
# include ValidationsFor | |
# | |
# validations_for page_type: 'offer' do | |
# validates :amount, presence: true | |
# end | |
# | |
# validations_for page_type: 'page' do | |
# validates :title, presence: true | |
# end |
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
source 'https://rubygems.org' | |
# add version numbers with the pessimistic constraint operator to all gems in your Gemfile | |
# https://github.com/joonty/pessimize | |
# change also in semaphore.yml and .ruby-version | |
# before upgrading check if SemaphoreCI supports it already: | |
# https://docs.semaphoreci.com/reference/semaphore-changelog/ | |
# To prevent forged authentication requests, we need to also include CSRF protection. If you're using OmniAuth with Rails, include: | |
# disabling for now - we would need to change facebook login to post, but there is client (JS) | |
# flow and server-side flow and there are differnces in hybrid apps... need to be tested well | |
# gem 'omniauth-rails_csrf_protection', '~> 0.1' |
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
task_result_stats = { | |
:task_11 => { | |
result_count: { neutral: 2, pisitive: 0, negative: 1 }, | |
percent_score: { neutral: '66%', negative: '34%', positive: '0' }, | |
participants: 3, | |
workers: { | |
result: { :worker_1 => :neutral, :worker_22 => :neutral, :worker_4 => :negative }, | |
fitness_score: { 1 => 1, 22 => 1, 4 => -1 } | |
} |
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
/* | |
* Tiny tokenizer | |
* | |
* - Accepts a subject string and an object of regular expressions for parsing | |
* - Returns an array of token objects | |
* | |
* tokenize('this is text.', { word:/\w+/, whitespace:/\s+/, punctuation:/[^\w\s]/ }, 'invalid'); | |
* result => [{ token="this", type="word" },{ token=" ", type="whitespace" }, Object { token="is", type="word" }, ... ] | |
* | |
*/ |
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
ReactiveRecord.load | |
ReactiveRecord::WhileLoading.quiet? | |
ReactiveRecord::Base.load_data | |
ReactiveRecord::Base.pending_fetches | |
React::Server.render_to_string(<Component>) | |
Model.saving? | |
React::IsomorphicHelpers.on_opal_client? | |
React::IsomorphicHelpers.on_opal_server? |
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
# RENDERING FROM ARRAY | |
# This works | |
render(DIV) do | |
@img = Sem.Image(size: 'small', src: 'http://via.placeholder.com/140x100').on(:click) {alert('ok') } | |
[ | |
@img, | |
span{'text'} | |
] | |
end |
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
import Ember from 'ember'; | |
import hbs from 'htmlbars-inline-precompile'; | |
import connect from 'ember-redux/components/connect'; | |
var stateToComputed = (state) => { | |
return { | |
number: state.number | |
}; | |
}; |
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
source 'https://rubygems.org' | |
gem 'mechanize' |
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
// Source: https://github.com/muut/riotjs/issues/727 | |
var Model = function (attrs) { | |
// init | |
this.attributes = attrs || {} | |
riot.observable(this) | |
// set method | |
this.set = function (key, val, options) { |
NewerOlder