This file contains 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 Greeter { | |
greet: ()=>string | |
} | |
var helloWorld:Greeter = { | |
greet: ():string =>{return "Hello World"} | |
} | |
console.log(helloWorld.greet()) |
This file contains 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 search(text:string, pattern:string): number { | |
let i:number = 0 | |
let j:number = 0 | |
for (i = 0; i < text.length; i++) { | |
for (j = 0; j < pattern.length && i + j < text.length; j++) { | |
if (text.charAt(i + j) != pattern.charAt(j)) { | |
break | |
} | |
} |
This file contains 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
"""A silly test.""" | |
import argparse | |
import inspect | |
import timeit | |
def parse_args(args=None, description=__doc__): | |
"""Parse input arguments.""" | |
parser = argparse.ArgumentParser(description=description) |
This file contains 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
"""Get a bunch of products from the API.""" | |
import json | |
import os | |
import requests | |
from requests.auth import HTTPBasicAuth | |
class APISession: | |
"""An API session.""" |
This file contains 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
#! /bin/bash | |
api='https://api.amberengine.com' | |
auth='<your email>:<your password>' | |
split-array() { | |
awk '{ | |
gsub(/^\[/, "") | |
gsub(/\]$/, "") | |
gsub(/ /, "") |
This file contains 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
const https = require('https'); | |
function getProductsByBrand(brand, limit, offset) { | |
let params = '?limit=' + limit.toString() + '&offset=' + offset.toString(); | |
let path = '/brands/' + brand + '/products' + params; | |
let options = {host: host, path: path, auth: auth} | |
https.get(options, (response) => { | |
data = ''; |
This file contains 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
FROM debian:jessie | |
RUN apt-get update -qq \ | |
&& apt-get install -qqy \ | |
apt-transport-https \ | |
curl \ | |
&& curl -sSL https://dl.google.com/linux/linux_signing_key.pub \ | |
| apt-key add - \ | |
&& echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list \ | |
&& echo "deb http://http.debian.net/debian jessie-backports main" >> /etc/apt/sources.list.d/jessie-backports.list \ |
This file contains 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
"""AWS SWF domains stuff.""" | |
import argparse | |
import boto3 | |
def get_swf_domains(client=boto3.client("swf"), **parameters): | |
"""Get AWS SWF domain names.""" | |
paginator = client.get_paginator("list_domains") | |
for response in paginator.paginate(**parameters): |
This file contains 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
""" | |
This is a sample workflow that includes a manual task. | |
Activities: | |
1. get_contact_activity | |
Get a subscription address. | |
2. subscribe_topic_activity | |
Create an SNS topic and subscribe the provided endpoints to the topic. |
This file contains 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
"""Convert number (0 indexed) to Excel spread sheet column.""" | |
import string | |
def number_to_column(number): | |
"""Convert number (0 indexed) to Excel spread sheet column.""" | |
if number < 0: | |
return "" | |
elif number < 26: | |
return string.ascii_uppercase[number] |