Skip to content

Instantly share code, notes, and snippets.

View brayoh's full-sized avatar
🎯
Focusing

Brian Njenga brayoh

🎯
Focusing
View GitHub Profile
@chris
chris / cognito.yml
Created May 21, 2021 17:31
Cognito user pool setup for Serverless (as CloudFormation resource)
#
# Cognito user pool/auth setup
#
Resources:
MyAppUserPool:
Type: AWS::Cognito::UserPool
Properties:
UserPoolName: myapp_user_pool
UsernameAttributes: # use email as username/login
- 'email'
@moaj257
moaj257 / Youtube Downloader - Mac - Using terminal.md
Last active March 8, 2024 01:29
Download youtube videos via mac terminal
  1. Open terminal.
  2. Use any one of following to install youtube-dl (A downloader written in python).
    • Fire these 2 command if you have curl installed.
    sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl 
    sudo chmod a+rx /usr/local/bin/youtube-dl
    
    • Fire these 2 commands

sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl

@getify
getify / 1.js
Last active March 3, 2023 09:23
is Maybe a "monad?
// is Just(..) a monad? Well, it's a monad constructor.
// Its instances are certainly monads.
function Just(v) {
return { map, chain, ap };
function map(fn) {
return Just(fn(v));
}
function chain(fn) {
return fn(v);
}
@codecitizen
codecitizen / serverless.yml
Created November 22, 2018 20:42
A serverless.yml file configuring a AWS ElastiCache redis instance that is accessible by all AWS Lambda functions deployed by this serverless function.
service: my-service
provider:
name: aws
runtime: nodejs8.10
stage: ${opt:stage, 'dev'}
environment:
REDIS_HOST:
"Fn::GetAtt": [ElasticCacheCluster, RedisEndpoint.Address]
functions:

Strings

String.prototype.*

None of the string methods modify this – they always return fresh strings.

  • charAt(pos: number): string ES1

    Returns the character at index pos, as a string (JavaScript does not have a datatype for characters). str[i] is equivalent to str.charAt(i) and more concise (caveat: may not work on old engines).

@gabeweaver
gabeweaver / react-cognito-auth-js.js
Last active January 20, 2024 15:03
React + Cognito User Pools + Cognito Identity JS Example
/*
This example was built using standard create-react-app out of the box with no modifications or ejections
to the underlying scripts.
In this example, i'm using Google as a social provider configured within the Cognito User Pool.
Each step also represents a file, so you can see how I've chosen to organize stuff...you can do it however
you'd like so long as you follow the basic flow (which may or may not be the official way....but its what I found that works.
The docs are pretty horrible)
@iamukasa
iamukasa / credentials.py
Last active December 6, 2017 09:08
Twitter bot to troll CS Joe Mucheru to stop pushing the ICT Practitioners Bill 2016
consumer_key = ' '
consumer_secret = ' '
access_token = ' '
access_token_secret = ' '
@giannisp
giannisp / gist:ebaca117ac9e44231421f04e7796d5ca
Last active March 1, 2024 14:39
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install postgresql@9.6
brew unlink postgresql@9.6
brew link postgresql
@sibelius
sibelius / Info.plist
Created November 17, 2016 15:34
ios 10 permissions
<!-- 🖼 Photo Library -->
<key>NSPhotoLibraryUsageDescription</key>
<string><Your description goes here></string>
<!-- 📷 Camera -->
<key>NSCameraUsageDescription</key>
<string><Your description goes here></string>
<!-- 🎤 Microphone -->
<key>NSMicrophoneUsageDescription</key>
@tpai
tpai / travis-coveralls.md
Last active February 20, 2019 07:20
Build Project with Travis-CI and Coveralls

Directory Structure

.
|-- dist/
|-- src/
|-- test/
|  `-- setup.jsx    # jsdom for renderIntoDocument()
|-- .babelrc
|-- .coveralls.yml