Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| var RecursiveChildComponent = React.createClass({ | |
| render() { | |
| return <div> | |
| {this.recursiveCloneChildren(this.props.children)} | |
| </div> | |
| }, | |
| recursiveCloneChildren(children) { | |
| return React.Children.map(children, child => { | |
| if(!_.isObject(child)) return child; | |
| var childProps = {someNew: "propToAdd"}; |
| /* | |
| Copy this into the console of any web page that is interactive and doesn't | |
| do hard reloads. You will hear your DOM changes as different pitches of | |
| audio. | |
| I have found this interesting for debugging, but also fun to hear web pages | |
| render like UIs do in movies. | |
| */ | |
| const audioCtx = new (window.AudioContext || window.webkitAudioContext)() |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| function slugify($string) { | |
| $string = preg_replace('/[\t\n]/', ' ', $string); | |
| $string = preg_replace('/\s{2,}/', ' ', $string); | |
| $list = array( | |
| 'Š' => 'S', | |
| 'š' => 's', | |
| 'Đ' => 'Dj', | |
| 'đ' => 'dj', | |
| 'Ž' => 'Z', | |
| 'ž' => 'z', |
| const { createRemoteFileNode } = require(`gatsby-source-filesystem`) | |
| // Note that WPGraphQL_MediaItem depends on your gatsby-source-graphql typeName which is set in the config | |
| exports.createResolvers = ({ | |
| actions, | |
| cache, | |
| createNodeId, | |
| createResolvers, | |
| store, |
This my receipe for installing a complete nodejs server on FreeBSD 10. The parameters used in this configuration are for a very small private server that I use for demo purpose only, so for a production server, you should somehow set the limits in pair with your ressources.
I use monit so I don't have to write rc scripts for node and it should take care of process lifecycle management for me. Alternatives exists such as supervisord or circus.
| /* global createImageBitmap */ | |
| function loadImageWithImageTag(src) { | |
| return new Promise((resolve, reject) => { | |
| const img = new Image; | |
| img.crossOrigin = ''; | |
| img.src = src; | |
| img.onload = () => { resolve(img); }; | |
| img.onerror = () => { reject(img); }; | |
| }); |
| function slugify(text) | |
| { | |
| return text.toString().toLowerCase() | |
| .replace(/\s+/g, '-') // Replace spaces with - | |
| .replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
| .replace(/\-\-+/g, '-') // Replace multiple - with single - | |
| .replace(/^-+/, '') // Trim - from start of text | |
| .replace(/-+$/, ''); // Trim - from end of text | |
| } |
| kind: Ingress | |
| apiVersion: extensions/v1beta1 | |
| metadata: | |
| name: redirect-ingress | |
| annotations: | |
| ingress.kubernetes.io/configuration-snippet: | | |
| if ($host ~ ^(.+)\.somedomain\.io$) { | |
| return 301 https://$1.domain.io$request_uri; | |
| } | |
| spec: |
| #!/bin/bash -e | |
| clear | |
| echo "============================================" | |
| echo "WordPress 4.9.x Install Script" | |
| echo "============================================" | |
| echo "Account User name: " | |
| read -e accuser | |
| echo "Database Host: " | |
| read -e dbhost | |
| echo "Database Name: " |