# How to echobot with XMPP, BOSH, and Strophe | |
1. Setup ejabberd(http://www.ejabberd.im/) server and setup account [email protected] | |
NOTE: localhost should be enough. If you setup something else, make sure you add it at /etc/hosts like this | |
#/etc/hosts | |
127.0.0.1 localhost.local | |
NOTE: Also download Psi(http://psi-im.org/), and make sure you can connect to your ejabberd server. | |
2. Download strophe(http://code.stanziq.com/strophe/) and place it (eg: /Users/makoto/work/sample/strophejs-1.0) |
These are my notes basically. At first i created this gist just as a reminder for myself. But feel free to use this for your project as a starting point. If you have questions you can find me on twitter @thomasf https://twitter.com/thomasf This is how i used it on a Debian Wheezy testing (https://www.debian.org/releases/testing/)
Discuss, ask questions, etc. here https://news.ycombinator.com/item?id=7445545
// === Arrays | |
var [a, b] = [1, 2]; | |
console.log(a, b); | |
//=> 1 2 | |
// Use from functions, only select from pattern | |
var foo = () => [1, 2, 3]; |
Picking the right architecture = Picking the right battles + Managing trade-offs
- Clarify and agree on the scope of the system
- User cases (description of sequences of events that, taken together, lead to a system doing something useful)
- Who is going to use it?
- How are they going to use it?
<?php | |
/** | |
* Create a Google Maps oEmbed Provider using the Google Maps Embed API | |
* | |
* @see https://developers.google.com/maps/documentation/embed/ | |
* @link https://gist.github.com/soderlind/db6dae8a73253329bc97ac50d7ebedef | |
* @since 1.0.0 | |
* @package Google_Maps_oEmbed_Provider | |
*/ | |
class DSS_oEmbed_Add_Provider { |
#Semantic Search engine – NLP lab
###17/05/2016 Task
Use the above blog to scrap the following information and show in terminal (ubuntu) or in a file in windows.
in case of processing a very large array e.g. Promise.all(A_VERY_LARGE_ARRAY_OF_XHR_PROMISE)
which would probably blow you browser memory by trying to send all requests at the same time
solution is limit the concurrent of requests, and wrap promise in thunk
Promise.allConcurrent(2)([()=>fetch('BLAH1'), ()=>fetch('BLAH2'),...()=>fetch('BLAHN')])
// determine if in-browser or using node.js | |
// thruthy | |
var _nodejs = ( | |
typeof process !== 'undefined' && process.versions && process.versions.node); | |
if (_nodejs) { | |
_nodejs = { | |
version: process.versions.node | |
}; | |
} |
import {promisify, CustomPromisify} from 'util' | |
export type FunctionProxy<T extends Function> = CustomPromisify<T> | |
export type PackageProxy<P extends { [key: string]: Function }> = { | |
[K in keyof P]: FunctionProxy<P[K]> | |
} | |
export function promised<T extends { [key: string]: Function | any }>(target: T): PackageProxy<T> { |