Suppose I have these components in my project:
class MessageHeader extends React.Component { /* ... */ }
class NiceButton extends React.Component { /* ... */ }
class FridgeContents extends React.Component { /* ... */ }
function createObservable(subscribe) { | |
return { | |
subscribe, | |
pipe: function(operator) { | |
return operator(this); | |
}, | |
}; | |
} | |
const numberObservable = createObservable(function(observer) { |
/** | |
* Callbag loves TypeScript | |
* | |
* Copy-paste this into http://www.typescriptlang.org/play/index.html | |
*/ | |
// A Callbag dynamically receives input of type I | |
// and dynamically delivers output of type O | |
type Callbag<I, O> = { | |
(t: 0, d: Callbag<O, I>): void; |
function xstreamToPullStream<T>(stream: Stream<T>): Readable<T> { | |
let hasBufferVal: boolean; | |
let bufferVal: T; | |
let bufferEndOrErr: any; | |
let callback: Callback<T>; | |
const listener: Listener<T> = { | |
next: t => { | |
console.log('pull stream Listener for xstream', t); | |
if (callback) { | |
console.log('pull stream direct', t); |
# Tweak tap coordinates as you wish | |
function reactnativedev() { | |
adb shell input keyevent 82; | |
sleep 0.1; | |
adb shell input tap 150 1401; | |
sleep 0.1; | |
adb shell input tap 150 1401; | |
sleep 0.1; | |
adb shell input text "$1"; | |
sleep 0.1; |
export function drained$<T>(pullStream: Function): Rx.Observable<T> { | |
return Rx.Observable.create(function subscribe(observer: Rx.Observer<T>) { | |
const drain = function drain(read: Function) { | |
read(null, function more(end: any | boolean, data: T) { | |
if (end === true) { | |
observer.complete(); | |
return; | |
} | |
if (end) { |
TypeScript supports Pick
to allow you to get a "subset" object type of a given type, but there is no built-in Pick
for deeper nested fields.
If you have a function that takes a large object as argument, but you don't use all of its fields, you can use Pick
, Pick2
, Pick3
, etc to narrow down the input type to be only just what you need. This will make it easier to test your function, because when mocking the input object, you don't need to pass all fields of the "large" object.
# Name it whatever you want. I like `y` because in my keyboard layout it's close to `;` | |
function y() { | |
previous=$? | |
if [ $previous -eq 0 ]; then | |
osascript -e "display notification \"Done\" with title \"Terminal Task\"" && say "it is done"; | |
else | |
osascript -e "display notification \"Failed\" with title \"Terminal Task\"" && say "it went to the trees"; | |
fi | |
} |
Not for everyone. Each programmer has their own appreciation of what is good coding music.
(From most influential to least)
101com.com, 101order.com, 123found.com, 180hits.de, 180searchassistant.com, 1x1rank.com, 207.net, 247media.com, 24log.com, 24log.de, 24pm-affiliation.com, 2mdn.net, 2o7.net, 360yield.com, 4affiliate.net, 4d5.net, 50websads.com, 518ad.com, 51yes.com, 600z.com, 777partner.com, 77tracking.com, 7bpeople.com, 7search.com, 99count.com, a-ads.com, a-counter.kiev.ua, a.0day.kiev.ua, a.aproductmsg.com, a.collective-media.net, a.consumer.net, a.mktw.net, a.sakh.com, a.ucoz.net, a.ucoz.ru, a.xanga.com, a32.g.a.yimg.com, aaddzz.com, abacho.net, abc-ads.com, absoluteclickscom.com, abz.com, ac.rnm.ca, accounts.pkr.com.invalid, acsseo.com, actionsplash.com, actualdeals.com, acuityads.com, ad-balancer.at, ad-balancer.net, ad-center.com, ad-images.suntimes.com, ad-pay.de, ad-rotator.com, ad-server.gulasidorna.se, ad-serverparc.nl, ad-souk.com, ad-space.net, ad-tech.com, ad-up.com, ad.100.tbn.ru, ad.71i.de, ad.980x.com, ad.a8.net, ad.abcnews.com, ad.abctv.com, ad.about.com, ad.aboutit.de, ad.aboutwebservices.com, ad.abum.com, |