This file contains hidden or 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
# Load DSL and Setup Up Stages | |
require 'capistrano/setup' | |
# Includes default deployment tasks | |
require 'capistrano/deploy' | |
require "capistrano/bundler" # NOTICE: capistrano/bundler, not capistrano/rails | |
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined. | |
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r } |
This file contains hidden or 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
def validate_uniqueness_scope(*attribute_array) | |
attributes_hash = Hash[attribute_array.map { |i| [ i, send(i)] }] | |
store.send(self.class.name.downcase.pluralize).where(attributes_hash).count.then do |count| | |
if count > 0 | |
{ self.class.name.downcase.to_sym => ["#{attributes_hash.values.join(', ')} already exists."] } | |
else | |
{} | |
end |
This file contains hidden or 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
ul.progress { | |
list-style: none; | |
margin: auto; | |
height: 100px; | |
background-color: transparent; | |
display: flex; | |
justify-content: space-between; | |
} | |
ul.progress li { | |
background-color: transparent; |
This file contains hidden or 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
$(document).ready(function(){ | |
$("a").click(function(){ | |
updateProgress($(this).closest('li').attr('id')); | |
}); | |
}); | |
var updateProgress = function(clickedId) { | |
console.log(clickedId); | |
var progress_nodes = $('ul.progress li'); | |
This file contains hidden or 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
/* EXPLANATIONS/EXAMPLES THAT MAY PROVIDE HELPFUL REFERENCE | |
http://erikras.github.io/redux-form/#/examples/asynchronous-blur-validation | |
https://github.com/erikras/react-redux-universal-hot-example/blob/b46921a990991e85522dbfc3195a46490a8f4e90/src/components/SurveyForm/SurveyForm.js | |
https://github.com/erikras/redux-form/issues/119 | |
*/ | |
// Working function with real request | |
export function asyncValidate (data) { | |
if (!data.email) { | |
return Promise.resolve({}) |
This file contains hidden or 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
<snippet> | |
<content><![CDATA[ | |
puts "${1:Output}: #{(${1:Output}).to_s}" | |
]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>pv</tabTrigger> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> | |
<!-- <scope>source.python</scope> --> | |
</snippet> |
This file contains hidden or 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 Board | |
def initialize | |
@rows = three_blank_rows | |
end | |
def playable_cell?(row, col) | |
return false unless (1..3).cover?(row) && (1..3).cover?(col) | |
@rows[col - 1][row - 1] == ' ' | |
end |
This file contains hidden or 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 SlowArray | |
def initialize(items) | |
operation! | |
@items = {} | |
items.each_with_index do |item, index| | |
@items[index] = item | |
end | |
end |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Add React in One Minute</title> | |
</head> | |
<body> | |
<h2>Add React in One Minute</h2> | |
<p>This page demonstrates using React with no build tooling.</p> |