Preact is a fast 3kB alternative to React with the same modern API.
This example uses shows how to use Material UI 4 with Preact X and Preact CLI 3.
git clone blah preact-mui
# Based on https://steveholgado.com/nginx-for-nextjs/ | |
# - /var/cache/nginx sets a directory to store the cached assets | |
# - levels=1:2 sets up a two‑level directory hierarchy as file access speed can be reduced when too many files are in a single directory | |
# - keys_zone=STATIC:10m defines a shared memory zone for cache keys named “STATIC” and with a size limit of 10MB (which should be more than enough unless you have thousands of files) | |
# - inactive=7d is the time that items will remain cached without being accessed (7 days), after which they will be removed | |
# - use_temp_path=off tells NGINX to write files directly to the cache directory and avoid unnecessary copying of data to a temporary storage area first | |
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=STATIC:10m inactive=7d use_temp_path=off; | |
upstream nextjs_upstream { |
Preact is a fast 3kB alternative to React with the same modern API.
This example uses shows how to use Material UI 4 with Preact X and Preact CLI 3.
git clone blah preact-mui
def extract(changeset) do | |
file_name = changeset.data.name | |
data = File.read!("#{@data_folder}/pages/#{file_name}") | |
case String.split(data, ~r/\n-{3,}\n/, parts: 2) do | |
[""] -> | |
%{frontmatter: nil, content: nil} | |
[frontmatter, content] -> | |
%{ | |
frontmatter: parse_yaml(frontmatter), | |
content: content |
import { Knex } from 'knex' | |
export async function up(knex: Knex): Promise<any> { | |
await knex.schema.createTable('test_setup', (table: Knex.TableBuilder) => { | |
table.integer('foobar'); | |
}); | |
} | |
export async function down(knex: Knex): Promise<any> { | |
await knex.schema.dropTable('test_setup'); |
◊;{ | |
This is free and unencumbered software released into the public domain. | |
Anyone is free to copy, modify, publish, use, compile, sell, or | |
distribute this software, either in source code form or as a compiled | |
binary, for any purpose, commercial or non-commercial, and by any | |
means. | |
In jurisdictions that recognize copyright laws, the author or authors | |
of this software dedicate any and all copyright interest in the |
package main | |
import ( | |
"strings" | |
"path/filepath" | |
) | |
func fileNameWithoutExtension(fileName string) string { | |
return strings.TrimSuffix(fileName, filepath.Ext(fileName)) | |
} |
I started with Elixir just a couple weeks after the switch from 1.4 to 1.5, so the bulk of online resources were out of date (or at least resulted in deprecation warnings). This guide is for defining Elixir 1.5 supervised modules.
It's not actually terribly complicated. It's just sometimes unclear from examples what's implemented by the language and what you actually have to implement yourself.
Say we want a supervision tree like this (where each atom is a process):
:a
/ \
# Backup | |
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
# Restore | |
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
#!/usr/bin/env ruby | |
require 'selenium-webdriver' | |
wd = Selenium::WebDriver.for :remote, url: 'http://10.3.1.7:4444/wd/hub', desired_capabilities: :chrome | |
wd.navigate.to 'https://snipt.net/restrada/python-selenium-workaround-for-full-page-screenshot-using-chromedriver-2x/' | |
# Get the actual page dimensions using javascript | |
# | |
width = wd.execute_script("return Math.max(document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth);") |