Real unit test (isolation, no children render)
Calls:
- constructor
- render
static func Basis(from: Vector3, to: Vector3) -> Basis: | |
if from.is_equal_approx(to): # then let it be | |
return | |
var axis = to.cross(from).normalized() # right-handed | |
var angle = -to.angle_to(from) # negates to force right-handed orientation | |
return Basis(axis, angle) | |
let prom = new Promise(res => { | |
console.log('A') | |
setTimeout(res,1000) | |
}) | |
prom.then(res => { | |
console.log('B') | |
}) | |
console.log('C') |
Building observables:
subscribe
function, but has the subscribe
function as a method. It's kind of like how you can make something that represents a function and then say, "But to call it, you need to call its .run
method."Subscription
object, not an unsubscribe
function.error
or complete
from the data source.next
should not be called after it.const entryByIdSelector = (state) => state.todos.entrybyId | |
const recentIdsSelector = (state) => state.todos.recentIds | |
const entrySelector = _.memoize( | |
(id) => createSelector( | |
entryByIdSelector, | |
(entryById) => entryById[id] | |
) | |
) | |
#!/bin/bash | |
mv $1 $1_tmp | |
git submodule deinit -f -- $1 | |
rm -rf .git/modules/$1 | |
git rm -f $1 | |
# Note: a/submodule (no trailing slash) | |
# or, if you want to leave it in your working tree and have done step 0 |
// [{suit:1,val:2}] -> 2 of diamonds | |
function isFlush(a) { | |
let suit, result = true; | |
for(var i=0; i<a.length;i++){ //should use a forloop to break early | |
const card = a[i] | |
if(suit===undefined) { | |
suit = card.suit | |
}else if(suit !== card.suit){ | |
return false |
public static T Func<T>(T a, T b){ | |
return new T(a + b); | |
} | |
public static void Main() { | |
print ("1 + 2 = " + Func (1, 2)); | |
print ("\"1\" + \"2\" = " + Func ("1", "2")); | |
} |
ES7 [function bind syntax][1] will add the ::
operator for working with these kind of functions:
/* ES7 */
import { map, takeWhile, forEach } from "iterlib";
getPlayers()
::map(x => x.character())
::takeWhile(x => x.strength > 100)