This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function append(arrOrNum, toAppendArrOrNum) { | |
if (!Array.isArray(arrOrNum)) { | |
arrOrNum = [arrOrNum]; | |
} | |
if (!Array.isArray(toAppendArrOrNum)) { | |
toAppendArrOrNum = [toAppendArrOrNum]; | |
} | |
return arrOrNum.concat(toAppendArrOrNum); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type TrafficLightState = | |
{ red: true, yellow: false, green: false } | | |
{ red: true, yellow: true, green: false } | | |
{ red: false, yellow: false, green: true } | | |
{ red: false, yellow: true, green: false } | |
function nextTrafficLightState( | |
trafficLight: TrafficLightState): TrafficLightState { | |
if (trafficLight.red && trafficLight.yellow) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface TrafficLight { | |
red: boolean; | |
yellow: boolean; | |
green: boolean; | |
} | |
function nextTrafficLightState( | |
trafficLight: TrafficLight): TrafficLight { | |
if (trafficLight.red && trafficLight.yellow) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface CurriedFunction2<T1, T2, R> { | |
(t1: T1): (t2: T2) => R; | |
(t1: T1, t2?: T2): R; | |
} | |
interface CurriedFunction3<T1, T2, T3, R> { | |
(t1: T1): CurriedFunction2<T2, T3, R>; | |
(t1: T1, t2?: T2): (t3: T3) => R; | |
(t1: T1, t2?: T2, t3?: T3): R; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SuaveBootstrapFlynn | |
open Suave | |
open Suave.Successful | |
open Suave.Web | |
open Suave.Operators | |
open Suave.Filters | |
open System | |
open System.Net |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule EchoBot.WeatherConversationAction do | |
use Wit.Actions | |
alias Wit.Models.Response.Converse, as: WitConverse | |
alias ExMicrosoftBot.Client | |
def say(_session_id, %{} = context, %WitConverse{msg: msg_to_send} = message) do | |
%{"session" => %{"from" => to, "to" => from, "msgId" => msgId}} = context | |
message_to_send = %{from: from, to: to, replyToMessageId: msgId, text: msg_to_send} | |
Client.send_message(get_bot_auth_data(), message_to_send) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule EchoBot.MessagesController do | |
use MicrosoftBot.Phoenix.Controller | |
alias ExMicrosoftBot.Models.Message | |
def message_received(conn, %Message{} = message) do | |
session_id = message.conversationId | |
spawn fn -> | |
%{from: from, to: to, id: msgId} = message | |
context = %{"session" => %{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'), | |
gutil = require('gulp-util'), | |
babelify = require('babelify'), | |
source = require('vinyl-source-stream'), | |
browserify = require('browserify'), | |
watchify = require('watchify'), | |
browserSync = require('browser-sync').create(); | |
var paths = { | |
HTML: 'src/index.html', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'), | |
gutil = require('gulp-util'), | |
eslint = require('eslint'), | |
babelify = require('babelify'), | |
source = require('vinyl-source-stream'), | |
browserify = require('browserify'); | |
var paths = { | |
ALL: ['index.js', 'lib/*.js'], | |
JS: ['index.js', 'lib/*.js'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule EphemeralShare.PeerState do | |
require Logger | |
use GenServer | |
def start_link(peer_id) do | |
GenServer.start_link(__MODULE__, [peer_id], [name: {:global, peer_state_proc_id(peer_id)}]) | |
end | |
def stop(peer_id) do | |
peer_id |