Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Mario Ruiz web20opensource

🎯
Focusing
View GitHub Profile
View botCourseDay2
const RtmClient = require('@slack/client').RtmClient;
const MemoryDataStore = require('@slack/client').MemoryDataStore;
const RTM_EVENTS = require('@slack/client').RTM_EVENTS;
const token = process.env.SLACK_TOKEN || '';
const witAppId = process.env.WIT_APP_ID || '';
const witToken = process.env.WIT_ACCESS_TOKEN || '';
const {Wit, log} = require("node-wit");
const wit = new Wit({accessToken: witToken});
View botCourseHi
const RtmClient = require('@slack/client').RtmClient;
const MemoryDataStore = require('@slack/client').MemoryDataStore;
const RTM_EVENTS = require('@slack/client').RTM_EVENTS;
const token = process.env.SLACK_TOKEN || '';
const rtm = new RtmClient(token, {
logLevel: 'error',
// logLevel: 'debug',
// Initialise a data store for our client, this will load additional helper functions for the storing and retrieval of data
dataStore: new MemoryDataStore(),
View stylefortemplate.css
/* Client-specific Styles */
#outlook a {padding:0;} /* Force Outlook to provide a "view in browser" message */
.ReadMsgBody {width:100%;} .ExternalClass {width:100%;} /* Force Hotmail to display emails at full width */
body{width:100% !important; max-width: 640px !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; -webkit-font-smoothing: antialiased; margin: 0 auto; padding:0; background-color: #DFDDDB;}
/* Prevent Webkit and Windows Mobile platforms from changing default font sizes, while not breaking desktop design. */
#backgroundTable {margin:0; padding:0; width:100% !important; line-height: 100% !important;}
img {outline:none; text-decoration:none;border:none; -ms-interpolation-mode: bicubic;}
a img {border:none;}
p {margin: 0px 0px !important;}
View jsonString.txt
{'tree': {'ID': 1 , 'Label': 'A', 'childrenNodes': [ {'ID': 2, 'Label': 'B', 'childrenNodes': [ {'ID': 5, 'Label': 'E'}, {'ID': 6, 'Label': 'F'}, {'ID': 7, 'Label': 'G'} ]}, {'ID': 3, 'Label': 'C'}, {'ID': 4, 'Label': 'D', 'childrenNodes': [ {'ID': 8, 'Label': 'H'}, {'ID': 9, 'Label': 'I'} ]} ]} }
View gist:070dd52cd1728684debc
var comments = document.querySelectorAll('#comment-list > li');
var winners = {};
getWinnerComment = function(id) {
return document.querySelectorAll('#' + id + ' .comment-content p')[0].textContent;
}
var iterations = 10000;
while(iterations--){
View ex14
return movieLists.
concatMap(function(category){
debugger;
return category.videos.concatMap(function(video){
debugger;
return video.boxarts.filter(function(box){
//safe coercion
return box.width=='150'
}).map(function(box){
debugger;
View index.html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="https://code.jquery.com/jquery-2.1.3.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/rxjs/2.3.25/rx.all.js"></script>
<script src="script.js"></script>
</head>
View script.js
// Code goes here
window.onload = function() {
var Observable = Rx.Observable;
var textbox = document.getElementById('textbox');
var keypresses = Observable.fromEvent(textbox, 'keypress');
var results = document.getElementById('results');
var searchButton = document.getElementById('searchButton');
var searchButtonClicks = Observable.fromEvent(searchButton, 'click');
function getWikipediaSearchResults(term) {
@web20opensource
web20opensource / ex12
Last active Aug 29, 2015
Learning RxJs
View ex12
return movieLists.map(
// map receives 3 args
// cat - element to iterate
// cIndex - index in the array of the element
// cCollection - movieLists array
// same applies for the rest if the code
(cat, cIndex, cCollection) => {
//v for videos object
return cat.videos.map ( (v,vIndex,vCollection) => {