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
function floatToWord(f) { | |
let b = new ArrayBuffer(4) | |
let iView = new Uint32Array(b) | |
let fView = new Float32Array(b) | |
fView[0] = f | |
return iView[0] | |
} | |
function wordToFloat(w) { | |
let b = new ArrayBuffer(4) |
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
-- | Names are hierarchies of strings, describing scope (so no danger of | |
-- duplicate names, but need to be careful on lookup). | |
data Name = UN !T.Text -- ^ User-provided name | |
| NS !Name [T.Text] -- ^ Root, namespaces | |
| MN !Int !T.Text -- ^ Machine chosen names | |
| SN !SpecialName -- ^ Decorated function names | |
| SymRef Int -- ^ Reference to IBC file symbol table (used during serialisation) | |
instance Show Name where |
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
function whereToEat(except) { | |
const ALL_OPTIONS = [ | |
{ name: 'Китайцы', days: [2, 3, 4, 5] }, | |
{ name: 'Итальянцы', days: [2, 3, 4, 5] }, | |
{ name: 'Греки', days: [1, 2, 3, 4, 5] }, | |
{ name: 'Суши', days: [2, 3, 4, 5] }, | |
{ name: 'Вьетнамцы', days: [2, 4, 5] }, | |
{ name: 'Кабул', days: [5] }, | |
{ name: 'Джерси Джо', days: [2, 3, 4, 5] }, | |
{ name: 'Бургеры', days: [2, 3, 4, 5] }, |
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
export interface FlexChild { | |
flexBase: number, | |
flexGrow: number, | |
flexShrink: number, | |
maxWidth?: number, | |
minWidth?: number | |
} | |
function sumBy<T>(items: T[], getter: (item: T) => number): number { | |
return items.reduce((sum, item) => sum + getter(item), 0) |
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
{ | |
"New React Class for CSP": { | |
"prefix": "new-react-csp", | |
"body": [ | |
"import * as React from 'react'", | |
"import * as bem from 'csp-react/src/bem'", | |
"", | |
"export interface ${Component}Props extends React.Props<${Component}> {", | |
"\tclassName?: string | { toString(): string }", | |
"}", |
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
const enum Order { | |
LT = -1, | |
EQ = 0, | |
GT = 1 | |
} | |
interface BWTransformed { | |
data: string, | |
start: number, | |
eof: number |
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
fn slice_to_i32_be(data: &[u8]) -> i32 { | |
assert!(data.len() >= 4); | |
let first = data[0]; | |
let sign = if first & 0x80 != 0 { -1 } else { 1 }; | |
sign * ( | |
(((first & 0x7F) as i32) << 24) + | |
((data[1] as i32) << 16) + | |
((data[2] as i32) << 8 ) + | |
( data[3] as i32 ) | |
) |
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 ExtractTextPlugin = require('extract-text-webpack-plugin') | |
var ExtendedDefinePlugin = require('extended-define-webpack-plugin') | |
var path = require('path') | |
module.exports = { | |
entry: './src/index.tsx', | |
resolve: { | |
alias: { | |
src: path.join(__dirname, 'src'), | |
store: path.join(__dirname, 'src', 'store'), |
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
exports.up = function(db) { | |
return new Promise(function (resolve, reject) { | |
db.dropTable('companies') | |
}).then( | |
db.createTable('companies', { | |
company_id: { type: 'bigserial', primaryKey: true }, | |
company_name: { type: 'string', unique: true }, | |
domain: { type: 'string', unique: true }, | |
owner: 'bigint' | |
}) |
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
import * as React from 'react' | |
interface Point { | |
x: number, | |
y: number | |
} | |
interface DraggableState { | |
dragStartPoint?: Point | |
} |
NewerOlder