Skip to content

Instantly share code, notes, and snippets.

Avatar
🌏
Not much contrib here as my org is now using a ADO exclusively

John Crisostomo johncrisostomo

🌏
Not much contrib here as my org is now using a ADO exclusively
  • JLL Technologies
  • Singapore
View GitHub Profile
@johncrisostomo
johncrisostomo / fromBeginning.js
Created February 28, 2019 04:27
tailing the cosmosdb change feed
View fromBeginning.js
const options = { startFromBeginning: true };
@johncrisostomo
johncrisostomo / cosmosdbtest.js
Created December 4, 2018 02:24
connecting and querying cosmodb sql api with nodejs
View cosmosdbtest.js
const CosmosClient = require('@azure/cosmos').CosmosClient;
const cosmosClient = new CosmosClient({
endpoint: '', // connection url
auth: {
masterKey:
'' // master key
}
});
@johncrisostomo
johncrisostomo / SimpleHttpClient.cs
Created July 30, 2018 08:59 — forked from bryanbarnard/SimpleHttpClient.cs
Simple C# .NET 4.5 HTTPClient Request Using Basic Auth and Proxy
View SimpleHttpClient.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net;
namespace HTTP_Test
@johncrisostomo
johncrisostomo / Component.jsx
Created July 25, 2018 09:16 — forked from krambertech/Component.jsx
ReactJS: Input fire onChange when user stopped typing (or pressed Enter key)
View Component.jsx
import React, { Component } from 'react';
import TextField from 'components/base/TextField';
const WAIT_INTERVAL = 1000;
const ENTER_KEY = 13;
export default class TextSearch extends Component {
constructor(props) {
super();
View keybase.md

Keybase proof

I hereby claim:

  • I am johncrisostomo on github.
  • I am johncrisostomo (https://keybase.io/johncrisostomo) on keybase.
  • I have a public key ASAh5aiooh4CROSQ5hQpK9sqS2FRtFPknkZPl0QSM_-bngo

To claim this, I am signing this object:

@johncrisostomo
johncrisostomo / permAlone.js
Created May 7, 2018 01:25
my solution for 'no repeats please' on fcc
View permAlone.js
function permAlone(str) {
if (str.length === 1) {
return 1;
}
var factorial = fact(str.length);
var permutations = computePermutations(str.split(''), factorial);
var unique = permutations.filter(function (perm) {
return !perm.match(/(.)\1{1,}/);
});
@johncrisostomo
johncrisostomo / arduino-bluetooth-led.ino
Created May 7, 2018 01:22
Arduino LED controlled over Bluetooth with NodeJS forked from eelcocramer
View arduino-bluetooth-led.ino
// This code uses the SoftwareSerial library.
// It can be obtained here: http://arduino.cc/en/Reference/SoftwareSerial
unsigned int timeout=0;
unsigned char state=0;
char val; // variable to receive data from the serial port
int ledpin = 13; // LED connected to pin 13
// Timer2 service
View error.js
it('should set SAVING_ERROR with the error message', () => {
const Meteor = {uuid: () => 'id', call: stub()};
const LocalState = {set: spy()};
const FlowRouter = {go: spy()};
const err = {message: 'Oops'};
Meteor.call.callsArgWith(4, err);
actions.create({Meteor, LocalState, FlowRouter}, 't', 'c');
expect(LocalState.set.args[1]).to.deep.equal([ 'SAVING_ERROR', err.message ]);
});
View create.js
create({Meteor, LocalState, FlowRouter}, title, content) {
if (!title || !content) {
return LocalState.set('SAVING_ERROR', 'Title & Content are required!');
}
LocalState.set('SAVING_ERROR', null);
const id = Meteor.uuid();
Meteor.call('posts.create', id, title, content, (err) => {
View posts.js
it('should call Meteor.call to save the post', () => {
const Meteor = {uuid: () => 'id', call: spy()};
const LocalState = {set: spy()};
const FlowRouter = {go: spy()};
actions.create({LocalState, Meteor, FlowRouter}, 't', 'c');
const methodArgs = Meteor.call.args[0];
expect(methodArgs.slice(0, 4)).to.deep.equal([
'posts.create', 'id', 't', 'c'