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
Path p = Path(); | |
p.addOval(Rect.fromPoints(Offset(0, 0), Offset(100, 100))); | |
final m = p.computeMetrics().first.getTangentForOffset(75 * pi); | |
print(m.position); |
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
void main() { | |
final func = Callable((a)=> print(a)); | |
func('a'); | |
} | |
class Callable { | |
Function func; | |
@override | |
noSuchMethod(invocation) { |
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 NodeTree { | |
insert(node: Node): void { | |
if (this.has(node)) { | |
throw new UnexpectedStructure() // TODO | |
} | |
const getParent = (): Node | undefined => { | |
const filter: TravelFilter = candidate => candidate.contains(node) ? Travel.ACCEPT : Travel.REJECT | |
const ancestorPaths = this.DFS(document.body, filter) |
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 * as ReactDOM from 'react-dom' | |
import * as React from 'react' | |
export class Component extends React.Component { | |
render() { | |
return <div style={{cursor: 'pointer', userSelect: 'none'}} | |
onClick={()=> this.clicked()}> | |
This text is clicked {this.state.count} times. | |
</div> | |
} |
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 {Maybe} from './Maybe' | |
describe('Maybe', ()=> { | |
const nothing = Maybe.Nothing | |
const just = Maybe.Just(1) | |
describe('Nothing', ()=> { | |
it('should not be exist', ()=> { | |
expect(nothing.exists).to.equal(false) | |
}) |
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 * as React from 'react' | |
import {Observable} from 'rxjs/Observable' | |
import {Subject} from 'rxjs/Subject' | |
import {ISubscription} from 'rxjs/Subscription' | |
import {Observables} from '../rxjs/Observables' | |
import {Pipes} from '../rxjs/Pipes' | |
import {Subjects} from '../rxjs/Subjects' | |
import {EventHandlers} from '../utils/EventHandler' | |
export abstract class ReactiveReactComponent<Props, State, Events> extends React.Component<Props, State> { |
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 * as React from 'react' | |
import {Subject, Observable, Scheduler} from 'rxjs' | |
import {ISubscription} from 'rxjs/Subscription' | |
import {createSubjects} from '../../../lib/rxjs-helpers/createSubjects' | |
import {Subjects} from '../../../lib/rxjs-helpers/Subjects' | |
import {Mapper} from "../../../lib/mapobject"; | |
export abstract class AbstractComponent<Props, State, Interactions> extends React.Component<Props, State> implements React.ComponentLifecycle<Props, State> { | |
protected abstract readonly interactionFilters: InteractionFilters<Interactions> | |
protected abstract viewLogic(): ISubscription[] |
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
# actions handlers are actors running in dedicated web workers | |
# send_event is their only way to return result | |
emit = (params...) -> this.postMessage params | |
handler = (func)-> | |
this.onmessage = (e)-> | |
try | |
func.apply this, e.data | |
finally |
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 Route | |
init: (root)-> | |
@root_url = root | |
window.addEventListener 'popstate', (=> @app.forceUpdate()) | |
conflict: (conflict_sets)-> | |
@conflict_sets = conflict_sets | |
resources: (resource_names)-> | |
@resource_names = resource_names |
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
[20] pry(main)> d = com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.new 'plocal:db/pacer' | |
=> #<Java::ComOrientechnologiesOrientCoreDbDocument::ODatabaseDocumentTx:0x6dccc34c> | |
[21] pry(main)> d.registerHook H.new | |
=> #<Java::ComOrientechnologiesOrientCoreDbDocument::ODatabaseDocumentTx:0x6dccc34c> | |
[22] pry(main)> dd = d.open 'admin', 'admin' | |
=> #<Java::ComOrientechnologiesOrientCoreDbDocument::ODatabaseDocumentTx:0x6dccc34c> | |
[23] pry(main)> g = com.tinkerpop.blueprints.impls.orient.OrientGraph.new dd | |
=> #<Java::ComTinkerpopBlueprintsImplsOrient::OrientGraph:0x1d6ed6d9> | |
[24] pry(main)> gg = Pacer.orient g | |
=> #<PacerGraph orientgraph[plocal:db/pacer] |
NewerOlder