$ rails g model User
belongs_to
has_one
| // Question 1 | |
| function incorrectChars( input, output) { | |
| const inputString = input.toLowerCase(); | |
| const outputString = output.toLowerCase(); | |
| const multiple = outputString.length / inputString.length; | |
| let incorrect = 0; | |
| for ( let i = 0; i < outputString.length - inputString.length; i + inputString.length ) { | |
| const outputSubString = outputString.substring(i, i+inputString.length); | |
| console.log('outputSubString: ' + outputSubString) |
| 'use strict'; | |
| var keys = []; | |
| var controlAlt = [ 'ctrl', 'alt' ]; | |
| var margin = 0; | |
| var increment = 0.1 | |
| function log() { | |
| Phoenix.log(JSON.stringify(arguments[0], true, 2)); | |
| } |
| import React, { Component } from 'react' | |
| import UserDetails from './UserDetails' | |
| /** | |
| * This utility function allows function calls to be debounced. | |
| * @param {Function} func Function that requires debouncing | |
| * @param {Number} wait Wait time in milliseconds between successive invocations | |
| */ | |
| const debounce = (func, wait) => { | |
| let timeout |
| from django.core.cache import cache as core_cache | |
| ''' | |
| refer: | |
| http://stackoverflow.com/questions/20146741/django-per-user-view-caching | |
| https://djangosnippets.org/snippets/2524/ | |
| ''' | |
| def cache_key(request): |
| var Table = React.createClass({ | |
| render: function render() { | |
| var _self = this; | |
| var thead = React.DOM.thead({}, | |
| React.DOM.tr({}, | |
| this.props.cols.map(function (col) { | |
| return React.DOM.th({}, col); | |
| }))); |
| { | |
| "AL": "Alabama", | |
| "AK": "Alaska", | |
| "AS": "American Samoa", | |
| "AZ": "Arizona", | |
| "AR": "Arkansas", | |
| "CA": "California", | |
| "CO": "Colorado", | |
| "CT": "Connecticut", | |
| "DE": "Delaware", |
| import csv | |
| from StringIO import StringIO | |
| from django.http import StreamingHttpResponse | |
| class StreamCSV(object): | |
| def __init__(self): | |
| self._buffer = StringIO() | |
| self._writer = csv.writer(self._buffer) |
| import Dexie from 'dexie'; | |
| import citiesJson from './cities.json'; | |
| const delay = () => | |
| new Promise(resolve => { | |
| setTimeout(() => { | |
| resolve(''); | |
| }, 1000); | |
| }); |