Skip to content

Instantly share code, notes, and snippets.

View zabirauf's full-sized avatar
👨‍💻
I may be slow to respond.

Zohaib Rauf zabirauf

👨‍💻
I may be slow to respond.
View GitHub Profile
@zabirauf
zabirauf / weather_conversation_action.ex
Created June 15, 2016 05:12
Weather conversation Wit.ai actions for the story created to get weather information. Complete project at https://github.com/zabirauf/witai_elixir_weather_bot
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)
@zabirauf
zabirauf / SuaveBootstrapFlynn.fs
Last active October 16, 2016 21:30
A F# Suave web app that outputs HTML
module SuaveBootstrapFlynn
open Suave
open Suave.Successful
open Suave.Web
open Suave.Operators
open Suave.Filters
open System
open System.Net
@zabirauf
zabirauf / FunctionBinder.ts
Last active March 8, 2017 07:42
And example for FunctionBinder class
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;
}
interface TrafficLight {
red: boolean;
yellow: boolean;
green: boolean;
}
function nextTrafficLightState(
trafficLight: TrafficLight): TrafficLight {
if (trafficLight.red && trafficLight.yellow) {
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) {
function append(arrOrNum, toAppendArrOrNum) {
if (!Array.isArray(arrOrNum)) {
arrOrNum = [arrOrNum];
}
if (!Array.isArray(toAppendArrOrNum)) {
toAppendArrOrNum = [toAppendArrOrNum];
}
return arrOrNum.concat(toAppendArrOrNum);
function append(
arrOrNum: number | number[],
toAppendArrOrNum: number | number[]): number[] {
if (!Array.isArray(arrOrNum)) {
arrOrNum = [arrOrNum];
}
if (!Array.isArray(toAppendArrOrNum)) {
toAppendArrOrNum = [toAppendArrOrNum];

Keybase proof

I hereby claim:

  • I am zabirauf on github.
  • I am zabirauf (https://keybase.io/zabirauf) on keybase.
  • I have a public key ASARuUOjzzy29X8HMZTWPwaznADwtY2m8LXL_HshE-64-Ao

To claim this, I am signing this object:

@zabirauf
zabirauf / init.vim
Last active February 16, 2022 21:01
Neovim configuration
call plug#begin()
" Autocompletion
Plug 'roxma/nvim-completion-manager'
Plug 'Valloric/YouCompleteMe', { 'do': './install.py --clang-completer --racer-completer --omnisharp-completer --tern-completer' }
Plug 'ervandew/supertab'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
" Buffer
// Code for StringToUintMap.sol
pragma solidity ^0.4.15;
library StringToUintMap {
struct Data {
mapping (string => uint8) map;
}
function insert(