Skip to content

Instantly share code, notes, and snippets.

View daslicht's full-sized avatar

Marc Wensauer daslicht

View GitHub Profile
@daslicht
daslicht / Observables vs Promises.ts
Created April 26, 2017 17:07
Observables vs Promises
/**
* Promises
*/
let selectedProduct = this.client.api( 'product', 'get', {id: product_id} );
let metadata = this.client.listMetafieldByProduct( product_id );
Promise.all([ selectedProduct , metadata ])
.then(( result) => {
console.log('result:', result);
})
api@api:~/microservice-video/dev$ npm install
> v8-debug@0.7.7 preinstall /home/api/microservice-video/dev/node_modules/.staging/v8-debug-87b3b14b
> node -e 'process.exit(0)'
> v8-profiler@5.6.5 preinstall /home/api/microservice-video/dev/node_modules/.staging/v8-profiler-40ea5c46
> node -e 'process.exit(0)'
@daslicht
daslicht / gist:fb7febc5992a2dbbc43e0754488aea09
Last active January 26, 2017 14:20
VPS Avenger Crash when open / close GUI via Maschine Hardware
Process: Maschine 2 [3032]
Path: /Applications/Native Instruments/*/Maschine 2.app/Contents/MacOS/Maschine 2
Identifier: com.native-instruments.Maschine 2
Version: 2.5.6 [R2] (2.5.6 [R2], Copyright © 2016 Native Instruments GmbH)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Maschine 2 [3032]
User ID: 502
Date/Time: 2017-01-26 13:15:52.193 +0100
@daslicht
daslicht / TypeScript no Classes.ts
Created January 24, 2017 17:17
TypeScript no Classes
// testModule.ts
let foo = 1;
let getFoo = () => {
console.log('foo', foo)
}
let incrementFoo = () => {
++foo;
downloadURL https://firebasestorage.googleapis.com/v0/b/product-videos-3c793.appspot.com/o/anita-hass-2%2Fproducts%2F9096539847%2Fvideo.mp4?alt=media&token=82b5b79f-b93e-4593-936b-82f0cd7cd231
Webhook: { id: 1963708,
event: 'source.transferred',
progress: '25%',
metadata:
{ streams: { video: [Object], audio: [Object] },
format:
{ name: 'mov',
duration: 8,
size: 10497024,
@daslicht
daslicht / index.php
Last active December 18, 2016 12:42
Return Image URL form a directory with PHP
<?php
/**
* Der Image Pfad auf dem server relative zu diesem Script
*/
$image_directory = "./images/";
/**
* Die base URL fuer die Bilder
*/
Process: Maschine 2 [4407]
Path: /Applications/Native Instruments/*/Maschine 2.app/Contents/MacOS/Maschine 2
Identifier: com.native-instruments.Maschine 2
Version: 2.5.0 [R5213] (2.5.0 [R5213], Copyright © 2016 Native Instruments GmbH)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Maschine 2 [4407]
User ID: 501
Date/Time: 2016-11-30 19:24:01.164 +0100
const moves = this.state.history.map((step:string[], move:number) => {
const desc = move ? 'Move #' + move : 'Game start';
return (
<li>
<a href="#" key={move} onClick={ () => this.jumpTo(move) } >{move}-{desc}</a>
</li>
);
});
module.exports = {
entry: "./entry.ts",
output: {
path: __dirname,
filename: "bundle.js"
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx']
},
devtool: 'source-map',
how do you cast the result of the following call to the Type of Slideshow ?, please:
getSlideshows():FirebaseListObservable<Slideshow> {
return this._af.database.list('/slideshows', {}) // returns type:
}
error:
Type 'FirebaseListObservable<any[]>' cannot be converted to type 'Slideshow'.