Skip to content

Instantly share code, notes, and snippets.

View tarasowski's full-sized avatar
:electron:

Dimitri (Dimi) Tarasowski tarasowski

:electron:
View GitHub Profile
@skeddles
skeddles / twitter-text-js.js
Created October 15, 2021 17:51
Javascript Browser Based Wrapping of Twitter-Text v3.1
/*
A browser compatible version of twitter-text (for counting tweet length) **
-----
Original Repo: https://github.com/twitter/twitter-text/tree/master/js
Packaged from: twitter-text-3.1.0.js
Using: browserify
For this: https://stackoverflow.com/questions/69575409/how-do-i-use-twitter-text-in-a-browser
*/
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
'use strict';
const Future = require ('fluture');
const S = require ('sanctuary');
// data Action = Reset | Increment Integer | Decrement Integer
// Reset :: Action
const Reset = {tagName: 'Reset'};
@npearce
npearce / install-docker.md
Last active May 17, 2024 12:03
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
@DrBoolean
DrBoolean / fp_arch.js
Last active October 27, 2020 09:57
OO => FP architecture refactor
// Simple example, but the idea holds for more complex objects.
/* 1) Start with OO */
// user.js
class User {
constructor(firstName, lastName, email) {
this.firstName = firstName
this.lastName = lastName
@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API
@adrianhall
adrianhall / AppSyncAPI.yaml
Last active March 19, 2023 14:57
A CloudFormation template for DynamoDB + Cognito User Pool + AppSync API for the Notes tutorial
---
Description: AWS AppSync Notes API
Parameters:
APIName:
Type: String
Description: Name of the API - used to generate unique names for resources
MinLength: 3
MaxLength: 20
AllowedPattern: '^[a-zA-Z][a-zA-Z0-9_]*$'
@adrianhall
adrianhall / AppSync-Example.yaml
Created April 13, 2018 16:01
An example CloudFormation template for AWS AppSync
---
Description: AWSAppSync DynamoDB Example
Resources:
GraphQLApi:
Type: "AWS::AppSync::GraphQLApi"
Properties:
Name: AWSAppSync DynamoDB Example
AuthenticationType: AWS_IAM
PostDynamoDBTableDataSource:
@BertrandBordage
BertrandBordage / lzw.py
Last active May 11, 2023 12:18
Lempel-Ziv-Welch algorithm in Python
from math import floor, ceil
from typing import AnyStr
ASCII_TO_INT: dict = {i.to_bytes(1, 'big'): i for i in range(256)}
INT_TO_ASCII: dict = {i: b for b, i in ASCII_TO_INT.items()}
def compress(data: AnyStr) -> bytes:
if isinstance(data, str):
@Will-777
Will-777 / sigmoidGraph.py
Last active November 13, 2021 09:44
simple sigmoid function with Python
#import section
from matplotlib import pylab
import pylab as plt
import numpy as np
#sigmoid = lambda x: 1 / (1 + np.exp(-x))
def sigmoid(x):
return (1 / (1 + np.exp(-x)))
mySamples = []