Skip to content

Instantly share code, notes, and snippets.

View blockchain-"research".md
@branneman
branneman / fp-lenses.js
Last active Feb 25, 2020
JavaScript: Lenses (Functional Programming)
View fp-lenses.js
// FP Lenses
const lens = get => set => ({ get, set });
const view = lens => obj => lens.get(obj);
const set = lens => val => obj => lens.set(val)(obj);
const over = lens => fn => obj => set(lens)(fn(view(lens)(obj)))(obj);
const lensProp = key => lens(prop(key))(assoc(key));
View InfluxDB_cheatsheet.md

InfluxDB Cheatsheet

Connect to InfluxDB using the commandline:

$ influx

Create a database foo:

CREATE DATABASE foo
@kitze
kitze / store-wrapper.js
Last active May 31, 2020
mobx store wrapper for storybook
View store-wrapper.js
import React from 'react';
import {Provider} from 'mobx-react';
const stub = () => true;
export const exampleStore = {
app: {},
auth: {
checkAuth: stub
},
@akashnimare
akashnimare / instructions.txt
Last active Aug 23, 2020
Download Frontend Master courses video. Note: This is for learning purpose only. Please don't mis-use it.
View instructions.txt
# Requirements
* Python 2.7
* Google Chrome
* ChromeDriver - WebDriver for Chrome
- Download the latest chromedrive which is 2.28 from here - https://sites.google.com/a/chromium.org/chromedriver/downloads
- Extract and move `chromedriver` file to `/usr/local/bin/chromedriver`
- git clone https://github.com/li-xinyang/OS_FrontendMaster-dl
- cd OS_FrontendMaster-dl
@sanusart
sanusart / localStorage.js
Last active Aug 1, 2020
Jest mock localStorage #test #jest
View localStorage.js
// ./__mocks__/localStorage.js
let mockStorage = {};
module.exports = window.localStorage = {
setItem: (key, val) => Object.assign(mockStorage, {[key]: val}),
getItem: (key) => mockStorage[key],
clear: () => mockStorage = {}
};
@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active Oct 18, 2020
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)
View letsencrypt_2020.md

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@jpillora
jpillora / smtp-gmail-send.go
Last active Oct 12, 2020
Send email using Go (Golang) via GMail with net/smtp
View smtp-gmail-send.go
package main
import (
"log"
"net/smtp"
)
func main() {
send("hello there")
}
@Leimi
Leimi / compile.js
Last active Sep 4, 2019
Checking environment in (node) Sass
View compile.js
#!/usr/bin/env node
var fs = require('fs');
var path = require('path');
var sass = require('node-sass');
var ENV = process.env.SASS_ENV || 'development';
var file = 'variables.scss';
//if in dev, directly pass file to sass
if (ENV === "development") {
@bzerangue
bzerangue / _verify-repair-permissions-disk.md
Last active Oct 3, 2020
Mac OS X Utilities via Terminal: (Verify and Repair: Disk Permissions AND Disk / Software Update / TimeMachine)
View _verify-repair-permissions-disk.md

Verify and Repair Disk Permissions via Terminal (Mac OS X)

Verify Permissions

diskutil verifyPermissions /

Repair Permissions

diskutil repairPermissions /

You can’t perform that action at this time.