Skip to content

Instantly share code, notes, and snippets.

@tech4him1
tech4him1 / commons.css
Last active October 2, 2017 16:27
React Toolbox v1 CSS
html {
font-size: 62.5%;
}
body {
position: absolute;
width: 100%;
height: 100%;
padding: 0;
margin: 0;
Package Current Wanted Latest Package Type URL
autoprefixer 6.7.7 6.7.7 7.1.5 devDependencies https://github.com/postcss/autoprefixer#readme
postcss-cssnext 2.11.0 2.11.0 3.0.2 devDependencies http://cssnext.io/
postcss-import 10.0.0 10.0.0 11.0.0 devDependencies https://github.com/postcss/postcss-import#readme
js-base64 2.1.9 2.3.2 2.3.2 dependencies https://github.com/dankogai/js-base64#readme
style-loader 0.18.2 0.18.2 0.19.0 devDependencies https://github.com/webpack/style-loader#readme
url-loader 0.5.9 0.5.9 0.6.2 devDependencies https://github.com/webpack-contrib/url-loader
uuid 2.0.3
collections:
- name: "settings"
label: "Settings"
delete: false # Prevent users from deleting documents in this collection
editor:
preview: false
files:
- name: "general"
label: "Site Settings"
file: "_data/settings.json"

Correct TOML parse:

{"menu":[{"main":[{"name":"a"},{"name":"new"}]}]}

Breaking TOML parse:

{"menu":{"main":[{"name":"a"},{"name":"new"}]}}
backend:
name: git-gateway
repo: custa1200/tvapp-themer # Path to your Github repository
branch: master # Branch to update (optional; defaults to master)
publish_mode: editorial_workflow
media_folder: "static/images/uploads" # Media files will be stored in the repo under static/images/uploads
public_folder: "/images/uploads" # The src attribute for uploaded media will begin with /images/uploads
collections: # A list of collections the CMS should be able to edit
import {hot} from 'react-hot-loader';
export default hot(module)(<div>This is a test.</div>);
import {hot} from 'react-hot-loader';
export default hot(module)(
<Provider store={store}>
<Router>
<div>This is a test.</div>
</Router>
</Provider>
);
@tech4him1
tech4him1 / filter.sh
Created April 6, 2018 15:50
Filter WordPress resized images
find uploads -regex ".*[0-9]+x[0-9]+\...?.?.?"
backend:
name: git-gateway
media_folder: "site/static/img" # Folder where user uploaded files should go
public_folder: "img"
collections: # A list of collections the CMS should be able to edit
- label: "Content"
name: "content"
folder: "site/content/content" # The path to the folder where the documents are stored
@tech4him1
tech4him1 / sha256random.js
Last active April 18, 2018 00:44
Generate random SHA256 look-alike.
const hashlen = 256;
const hashbase = 16;
const randomNums = new Uint32Array(hashlen / 32);
window.crypto.getRandomValues(randomNums);
const padNum = (num, base) => {
const padLen = (32 / Math.sqrt(base));
const str = num.toString(base);
return (('0' * padLen) + str).slice(-padLen);