Skip to content

Instantly share code, notes, and snippets.

View akellbl4's full-sized avatar

Paul akellbl4

View GitHub Profile
@akellbl4
akellbl4 / iTermSettings.plist
Last active July 1, 2018 07:37
iTerm2 Settings Profile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AppleAntiAliasingThreshold</key>
<integer>1</integer>
<key>AppleScrollAnimationEnabled</key>
<integer>0</integer>
<key>AppleSmoothFixedFontsSizeThreshold</key>
<integer>1</integer>
@akellbl4
akellbl4 / bluetooth_headphones.scpt
Created June 29, 2018 15:30 — forked from kevinjalbert/bluetooth_headphones.scpt
AppleScript to connect bluetooth headphones and show its battery level
activate application "SystemUIServer"
set deviceName to "Pavels's BeatsX"
tell application "System Events"
tell process "SystemUIServer"
set bluetoothMenu to (menu bar item 1 of menu bar 1 whose description contains "bluetooth")
tell bluetoothMenu
click
set deviceMenuItem to (menu item deviceName of menu 1)
@akellbl4
akellbl4 / gatsby-node.js
Created July 20, 2018 15:07
Gatsby v2 absolute resolving from `src` folder without plugins
const path = require('path')
exports.onCreateWebpackConfig = ({ actions, getConfig }) => {
actions.setWebpackConfig({
resolve: {
modules: [path.resolve(__dirname, 'src')],
},
})
}
@akellbl4
akellbl4 / transform-image-by-canvas.html
Last active December 13, 2018 06:48
Mass transform images and download by one click
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<style>
@akellbl4
akellbl4 / createAction.ts
Created October 31, 2019 08:39
Redux Action Creator
export type Action<P, T = string> = { type: T; payload: P | undefined }
export function createAction<T, P = any>(type: T) {
const actionCreator = (payload: P | undefined): Action<P, T> => ({ type, payload })
actionCreator.type = type
return actionCreator
}
import React, { Component } from 'react'
import { createPortal } from 'react-dom'
import { fetchAndPlay, playVideo } from 'utils/video'
import throttle from 'lodash/throttle'
import PlayBG from 'views/NewApp/components/PlayBG'
import styles from './BGVideo.css'
class BGVideo extends Component {
componentDidMount() {
this.loadBackground()
const { PUBLIC_NEXT_API_URL } = process.env;
let citiesRequest;
export function fetchCities() {
if (!citiesRequest) {
citiesRequest = fetch(`${PUBLIC_NEXT_API_URL}/cities`);
}
return citiesRequest;
const path = require("path");
const crypto = require("crypto");
const fs = require("fs/promises");
const fetch = require("isomorphic-unfetch");
const { API_URL, CACHE_DIR } = process.env;
const RESOUCES = ["/posts", "/albums"];
function getFilename(str) {
const hash = crypto.createHash("sha1").update(str).digest("hex");
const http = require("http");
const path = require("path");
const crypto = require("crypto");
const fs = require("fs/promises");
const { HOST, PORT, CACHE_DIR } = process.env;
function getFilename(str) {
const hash = crypto.createHash("sha1").update(str).digest("hex");
const http = require("http");
const fetch = require("isomorphic-unfetch");
const { API_URL, PORT, HOST } = process.env;
const map = new Map();
async function handler(req, res) {
if (map.has(req.url)) {
const data = await map.get(req.url);