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 deserialize(res) { | |
var header = res.headers.get('Content-Type'); | |
if (!header) return res.text(); | |
return res.headers.get('Content-Type').indexOf('application/json') > -1 ? res.json() : res.text(); | |
} |
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
export function removeFromCart(sku: string) { | |
return bind(cookie('token'), (token) => { | |
var headers = { | |
'Authorization': `Bearer ${token}`, | |
'Content-Type': 'application/json', | |
}; | |
return bind(fetch(`${process.env.CART_API_URL}cart/products/${sku}`, | |
{ | |
mode: process.env.FETCH_MODE, | |
headers: headers, |
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
/* @flow */ | |
import cookie from 'declarative-cookie'; | |
import {createAction} from 'redux-actions' | |
import fetch from 'declarative-fetch' | |
import bind from 'bind-effect' | |
import { | |
AUTH_GUEST_SUCCESS, | |
AUTH_GUEST_FAILURE, |
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 hasValue(value) { | |
return !!value | |
|| value === 0 | |
|| value === false | |
} | |
/** | |
* @description | |
* getSubset returns an object with the same structure as the original object passed in, but contains | |
* only the specified paths and only if those paths have "value" (truth-y values, 0 or false). |
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
def add_missing_answers | |
answer_count = @check_in.check_in_answers.length | |
return if answer_count >= 4 | |
answers_to_add = 4 - answer_count | |
answers_to_add.times do | |
@check_in.check_in_answers.build | |
end | |
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
def staff_tab(base_url) | |
sublinks = [] | |
sublinks << {title: 'View All Staff', href: "#{base_url}/staff"} | |
sublinks << {title: 'Add New Staff', href: "#{base_url}/staff/new"} if current_user.can_manage?(org, [PermissionsSet::MANAGE_STAFF]) | |
{ title: 'Staff', href: "#{base_url}/staff", icon:'icon-home', sublinks: sublinks } | |
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
<div class="tabs-content-container" > | |
<div class="container tabbable"> | |
<div class="section-container kyck-tabs" data-section="auto" data-section-resized="true"> | |
<% build_tabs(@org, @team, @competition, @division).each do |k, t| | |
next if !t %> | |
<section class="section tabPane" <%= t[:disabled] || '' %> title="<%= t[:title] %>" href="<%= t[:href] %>" state="<%= t[:state] || '' %>"></section> | |
<% next unless t[:sublinks] %> | |
<ul class='sublinks'> | |
<% t[:sublinks].each do |st| %> | |
<li class="section tabPane" <%= st[:disabled] || '' %> title="<%= st[:title] %>" href="<%= st[:href] %>" state="<%= st[:state] || '' %>"></li> |
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
def create | |
@post = Post.new(post_params) | |
respond_to do |format| | |
Rails.logger.info "*** format = #{format.inspect}" | |
if @post.save | |
format.html { redirect_to root_path } | |
format.js # Will search for create.js.erb | |
else | |
format.html { render root_path } | |
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
deploy: | |
provider: ninefold | |
auth-token: "PqVXvVMWqHR6XF4UqZFqvoZwEpMlXcO_SkoCl6NPinmJ8KT1uMkl7ws_lihOoAk2iQ5rpfqF-mRRWHozuKp_yA" | |
app-id: "10906" | |
edge: true | |
skip_cleanup: true | |
before_script: | |
- psql -c "DROP DATABASE IF EXISTS ninethings_test;" -U postgres | |
- psql -c 'create database ninethings_test;' -U postgres |