Skip to content

Instantly share code, notes, and snippets.

View hieuhani's full-sized avatar
🎯
The beginning is the end and the end is the beginning

Hieu Tran hieuhani

🎯
The beginning is the end and the end is the beginning
View GitHub Profile
import PromiseRouter from './PromiseRouter'
function hello(req) {
const { authController } = req.config
return authController.sayHello()
}
export default class AuthRouter extends PromiseRouter {
mountRoutes() {
this.route('GET', '/hello', req => (hello(req)))
import Joi from 'joi'
import jwt from 'jsonwebtoken'
import logger from '../logger'
import RestController from './RestController'
import AppError from '../AppError'
export default class ApplicationsController extends RestController {
async validateAppToken(payload) {
logger.debug('validate application token with data', payload)
const validationSchema = Joi.object().keys({
import React from 'react'
import {
View,
StyleSheet,
} from 'react-native'
import { connect } from 'react-redux'
import { NavigationScreenProp } from 'react-navigation'
import Colors from '../../common/Colors'
import Header from '../../common/Header'
import Transactions from './Transactions'
export const UPDATE_INVENTORY_ADJUSTMENTS = 'UPDATE_INVENTORY_ADJUSTMENTS'
export function updateInventoryAdjustments(inventoryAdjustments) {
return {
type: UPDATE_INVENTORY_ADJUSTMENTS,
payload: {
inventoryAdjustments,
},
}
}
import { AsyncStorage } from 'react-native'
import { OdooRPC } from '../node-odoorpc'
type QueryFirstParams = {
model: string,
id: number,
fields: [string],
}
type QueryParams = {
import { createSelector } from 'reselect'
const selectGlobal = state => state.global
const selectNetworkEnabled = createSelector(selectGlobal, global => global.networkEnabled)
const selectServerConnectionStatus = createSelector(
selectGlobal,
global => global.serverConnectionStatus,
)
const selectLoginStatus = createSelector(
# -*- coding: utf-8 -*-
#----------------------------------------------------------
# OpenERP HTTP layer
#----------------------------------------------------------
import ast
import collections
import contextlib
import datetime
import functools
import hashlib
0x5C9adE285d402001847E624BD64a57f0C9D467ce

Inspired by this article. Neat tricks for speeding up integer computations.

Note: cin.sync_with_stdio(false); disables synchronous IO and gives you a performance boost. If used, you should only use cin for reading input (don't use both cin and scanf when sync is disabled, for example) or you will get unexpected results.

Multiply by a power of 2

x = x << 1; // x = x * 2

import React from 'react';
import PropTypes from 'prop-types';
import Immutable from 'immutable';
import styled from 'styled-components';
import { Link } from 'react-router';
import ViewBranchListPanel from '../../components/ViewBranchListPanel';
import './styles.scss';
const TableList = styled.ul`
padding-left: 0;