Skip to content

Instantly share code, notes, and snippets.

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();
}
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,
/* @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,
var React = require('react');
import cookie from 'redux-effects-cookie';
import type {RequestAction} from '../__types';
import { GET_COOKIE, SET_COOKIE } from '../constants/ActionTypes';
export function setCookie(name, value) {
console.log("SETTING coOOKIE to" + value);
var payload= {};
return {
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).
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
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
<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>
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
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