Skip to content

Instantly share code, notes, and snippets.

View imns's full-sized avatar

Nate Smith imns

View GitHub Profile
@rogerchi
rogerchi / cdk-websocket-with-domain.ts
Created August 23, 2021 13:04
CDK Websocket Domain Name example
import * as path from 'path';
import * as apigatewayv2 from '@aws-cdk/aws-apigatewayv2';
import * as apigatewayv2Integrations from '@aws-cdk/aws-apigatewayv2-integrations';
import * as certificatemanager from '@aws-cdk/aws-certificatemanager';
import * as lnjs from '@aws-cdk/aws-lambda-nodejs';
import * as route53 from '@aws-cdk/aws-route53';
import * as alias from '@aws-cdk/aws-route53-targets';
import * as cdk from '@aws-cdk/core';
export interface WebsocketExampleProps {
@davestevens
davestevens / README.md
Created February 19, 2021 17:01
Fetching all comments from a Reddit post

Reddit API

I could not find a simple example showing how to consume the Reddit API to get the comments for a post. This shows step by step how to authenticate and the endpoints to request.

Setup

You need to create an app to get an app id and secret. Go to https://www.reddit.com/prefs/apps and at the bottom of the page under "developed applications" create a new app or view a current one.

If you click "edit" to open the app view you will be able to see the app id and secret, these are required for authentication.

@nat-n
nat-n / Recipe-bundling-fonts-with-headless-chrome.md
Last active February 28, 2024 19:23
How to build a fontconfig bundle for adding arbitrary fonts to headless chrome independent of the OS. This is specifically useful for deploying headless chrome to AWS lambda where it is necessary to include fonts for rendering CJK (Chinese, Japanese, Korean) characters into the deployed bundle.

Building fontconfig

Start up a lambda-like docker container:

docker run -i -t -v /tmp:/var/task lambci/lambda:build /bin/bash

Install some dependencies inside the container:

yum install gperf freetype-devel libxml2-devel git libtool -y

easy_install pip

Launch List

Checklist for pre launch
  • All text free from spelling errors
  • Page and content formatting appropriate on all pages
  • Placeholder text removed
  • All pages have content
  • Privacy Policy included (Generate one at getterms.io)
  • Favicon created and displays correctly (retina included)
@pouyakary
pouyakary / connectHTMLelements_SVG.png
Created June 5, 2016 13:46 — forked from alojzije/connectHTMLelements_SVG.png
Connect two elements / draw a path between two elements with SVG path (using jQuery)
connectHTMLelements_SVG.png
@ChisholmKyle
ChisholmKyle / redislimiter.js
Created February 11, 2016 08:05
General purpose rate limiters using Redis and ioredis in node.js
var Ioredis = require('ioredis');
var redis = new Ioredis();
// Rolling window rate limiter
//
// key is a unique identifier for the process or function call being limited
// exp is the expiry in milliseconds
// maxnum is the number of function calls allowed before expiry
var redis_limiter_rolling = function(key, maxnum, exp, next) {
redis.multi([
@afeld
afeld / gist:4952991
Last active February 8, 2022 03:13
good APIs for mashups

This list has been superseded by Public APIs. Check there for APIs with Auth: No, HTTPS and CORS Yes.


List of data APIs that require no server-side auth or private credentials, and are thus good for small browser-only JS projects.

@coolaj86
coolaj86 / how-to-publish-to-npm.md
Last active September 7, 2024 22:18
How to publish packages to NPM

Getting Started with NPM (as a developer)

As easy as 1, 2, 3!

Updated:

  • Aug, 08, 2022 update config docs for npm 8+
  • Jul 27, 2021 add private scopes
  • Jul 22, 2021 add dist tags
  • Jun 20, 2021 update for --access=public
  • Sep 07, 2020 update docs for npm version
@leah
leah / json-response.py
Created October 5, 2011 19:08
JSONResponse classes
import re
import simplejson
from django.http import HttpResponse
from django.conf import settings
class JSONResponse(HttpResponse):
def __init__(self, request, data):
indent = 2 if settings.DEBUG else None