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
| function animate(pos, direction, delta) { | |
| return pos.plus(direction.scaleBy(delta)) | |
| } |
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
| function isValidOrder(order, customer) { | |
| return | |
| order.units > 1 && | |
| order.state == 'complete' && | |
| includingSalesTax(order.price) < customer.availableBalance | |
| } |
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
| function isValidOrder(order, customer) { | |
| const salesTaxPercentage = 0.15 | |
| return | |
| order.units > 1 && | |
| order.state == 'complete' && | |
| order.price * (1.0 + salesTaxPercentage) < customer.availableBalance | |
| } |
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
| # cookbook/ingredients/schema.py | |
| from graphene import relay, ObjectType | |
| from graphene.contrib.django.filter import DjangoFilterConnectionField | |
| from graphene.contrib.django.types import DjangoNode | |
| from cookbook.ingredients.models import Category, Ingredient | |
| # Graphene will automatically map the Category model's fields onto the CategoryNode. | |
| # This is configured in the CategoryNode's Meta class (as you can see below) |
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
| module PersonRow exposing (..) | |
| import Html exposing (..) | |
| import Html.App as App | |
| import WeekButtons | |
| -- MODEL | |
| type alias Model = { |
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
| import ModelStore from './model_store' | |
| class ModelEnricher { | |
| constructor() { | |
| this.modelStore = new ModelStore(); | |
| } | |
| enrichAggregateResult(result, onSuccess) { | |
| const modelKeys = this.modelKeys(result.results); | |
| this.modelStore.loadModels(modelKeys, (results) => { |
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
| module.exports = () -> | |
| request = require('request').defaults( | |
| headers: | |
| 'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0', | |
| 'Accept-Language': "en-US,en;q=0.5", | |
| 'Connection': "keep-alive" | |
| ) | |
| cheerio = require('cheerio') | |
| request.post 'https://fetlife.com/session', {jar: true, followRedirect: true, form: {nickname_or_email: 'make-you-a-man', password: 'studmuffin', utf8: '✓'}}, (error, response, body) -> |
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 IndentManager | |
| def initialize | |
| @indents = [] | |
| @parse_complete = false | |
| end | |
| def register_indent(indent) | |
| @indents << indent | |
| 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 CreateInitialDb < ActiveRecord::Migration | |
| def change | |
| create_table :people do |t| | |
| end | |
| create_table :buckets do |t| | |
| end | |
| create_table :budgets do |t| | |
| 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
| module Xeroizer | |
| module Http | |
| private | |
| def http_request(client, method, url, body, params = {}) | |
| # headers = {'Accept-Encoding' => 'gzip, deflate'} |