Skip to content

Instantly share code, notes, and snippets.

@YumaInaura
YumaInaura / ZSH.md
Last active January 8, 2023 14:11
Zsh — How to create user defined widget and map with bindkey ( For very beginner of zle )

Zsh — How to create user defined widget and map with bindkey ( For very beginner of zle )

Another titles

  • How to add customized event and bind keymap
  • The very beginner to zle of zsh keymapping with bindkey

Step. Create function in shell

@bradwestfall
bradwestfall / S3-Static-Sites.md
Last active May 22, 2024 13:44
Use S3 and CloudFront to host Static Single Page Apps (SPAs) with HTTPs and www-redirects. Also covers deployments.

S3 Static Sites

⚠ This post is fairly old. I don't keep it up to date. Be sure to see comments where some people have posted updates

What this will cover

  • Host a static website at S3
  • Redirect www.website.com to website.com
  • Website can be an SPA (requiring all requests to return index.html)
  • Free AWS SSL certs
  • Deployment with CDN invalidation
@l1x
l1x / reasonml.md
Last active September 27, 2017 17:02

Starting with ReasonML for backend devs

Background

Bucklescript

BuckleScript is a backend for the OCaml compiler which emits JavaScript. It works 
with both vanilla OCaml and Reason, the whole compiler is compiled into JS (and ASM) 
so that you can play with it in the browser.
@lilactown
lilactown / promises.re
Last active August 20, 2022 07:56
Notes on using JavaScript Promises in ReasonML/BuckleScript
/**
* Making promises
*/
let okPromise = Js.Promise.make((~resolve, ~reject as _) => [@bs] resolve("ok"));
/* Simpler promise creation for static values */
Js.Promise.resolve("easy");
Js.Promise.reject(Invalid_argument("too easy"));
@alexandru
alexandru / web-crawler.ts
Last active January 7, 2021 12:42
Web crawler that downloads HTML content (for analysis) from a list of websites, exporting content as JSON lines
#!/usr/bin/env node
import { IO, Try, Success, Failure, Either, Left, Right, Cancelable, Duration } from "funfix"
import { RequestResponse } from "request"
import * as fs from "fs"
import * as request from "request"
import * as Url from "url"
import * as cheerio from "cheerio"
import * as minimist from "minimist"
const http = require('http');
// Swagger-like API description
const api = {
'/users': {
'get': {
'parameters': {
'role': {
'in': 'query'
},
@alexeygolev
alexeygolev / convert.js
Last active May 17, 2016 09:10
convertFromHtml in node
const jsdom = require('jsdom').jsdom
const fs = require('fs')
const path = require('path')
const {
ContentState,
convertToRaw,
convertFromRaw,
} = require('draft-js')
const React = fs.readFileSync(path.join(__dirname, '../node_modules/react/dist/react.js'))
@davisml
davisml / draftToHTML.js
Last active March 9, 2017 12:47
DraftJS block data to HTML
// AttributedString class from https://github.com/cohitre/attributedString.js
// Modifications made to support html tags & remove span wrapper from unstyled blocks
var AttributedString = (function () {
var aString
, StringRange
, RangesList
, HtmlSerializer
, plainStringSerializer
, _ = {}
, entityMap = {
@DrBoolean
DrBoolean / comonads-are-objects.js
Created December 23, 2015 19:55
Comonads are objects js style.
// http://www.haskellforall.com/2013/02/you-could-have-invented-comonads.html
const daggy = require('daggy');
const {toUpper, prop, identity, range, curry, compose} = require('ramda');
const Config = daggy.tagged("opts")
Config.prototype.inspect = function() {
return `Config(${this.opts})`
}
//https://gist.github.com/quelgar/4661081
const daggy = require('daggy');
const {range} = require('ramda');
// type to hold an index and the array
const Pointer = daggy.tagged('i', 'a')
// Comonad instance
Pointer.prototype.extract = function() { return this.a[this.i] }