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
{ | |
"name": "myApp", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], | |
"author": "", |
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
from django.contrib.auth.models import BaseUserManager | |
class MyUserManager(BaseUserManager): | |
def create_user(self, email, password=None, **kwargs): | |
if email is None: | |
raise TypeError('user must have an email') | |
user = self.model(email=self.normalize_email(email)) | |
user.set_password(password) | |
user.save(using=self._db) | |
return user |
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
# settings file: | |
AUTH_USER_MODEL = 'accounts.User' | |
AUTHENTICATION_BACKENDS = ('accounts.backend.MyBackend', ) | |
# backend.py in usercp (APP) folder | |
from models import Customer | |
from django.contrib.auth.hashers import check_password | |
# Taken from http://www.djangorocks.com/tutorials/creating-a-custom-authentication-backend/creating-a-simple-authentication-backend.html | |
class MyAuth: |
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
graph = { | |
'A': ['B', 'C', 'E'], | |
'B': ['A', 'D', 'E'], | |
'C': ['A', 'F', 'G'], | |
'D': ['B'], | |
'E': ['A', 'B', 'D'], | |
'F': ['C'], | |
'G': ['C'] | |
} |
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
var debug = process.env.NODE_ENV !== "production"; | |
var HtmlWebpackPlugin = require('html-webpack-plugin'); | |
var ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
var HtmlWebpackPluginConfig = new HtmlWebpackPlugin({ | |
template: __dirname + '/app/index.html', | |
filename: 'index.html', | |
inject: 'body' | |
}) | |
module.exports = { |
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 React from 'react'; | |
import {RadioItem, RadioGroup} from './Radio'; | |
type P = {}; | |
type S = {}; | |
class App extends React.Component<P, S> { | |
render() { | |
return ( |
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
/node_modules | |
/coverage | |
/flow-typed/npm | |
/src/registerServiceWorker.js | |
*.json |
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
// 1. getAverage; | |
let getAverage = array => array.reduce((a, b) => a + b, 0) / array.length | |
// 2. DigitsExplode | |
let explode = s => s.replace(/[0-9]/g, d => d.repeat(d)); | |
// 3. Parse string to key value pairs | |
function wordsToObject(input) { | |
let arr = input.split(" "); | |
const L = arr.length; |
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
type action = | |
| AddTodo | |
| DeleteTodo(int) | |
| CheckTodo(int) | |
| CheckAll | |
| HandleInput(string) | |
| ShowCompleted | |
| ShowDoing | |
| ShowAll; |
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
let split = (string) => { | |
let rec toList = (l, i) => | |
switch (i) { | |
| 0 => l | |
| num => toList([string.[num - 1], ...l], num - 1) | |
}; | |
toList([], string |> String.length) | |
}; |
OlderNewer