sudo apt-get install -y awscli
sudo logrotate -d -f /etc/logrotate.d/nginx
sudo logrotate -f /etc/logrotate.d/nginx
function calcChecker1 (firstNineDigits) { | |
let sum = null | |
for (let j = 0; j < 9; ++j) { | |
sum += firstNineDigits.toString().charAt(j) * (10 - j) | |
} | |
const lastSumChecker1 = sum % 11 | |
const checker1 = (lastSumChecker1 < 2) ? 0 : 11 - lastSumChecker1 |
#!/bin/bash | |
# | |
# chkconfig: 35 95 05 | |
# description: Hello world application. | |
# Run at startup: sudo chkconfig hello-world on | |
# Load functions from library | |
. /etc/init.d/functions |
These examples are presented in an attempt to show how each coding styles attempts to or does not attempt to isolate side-effects. There are only 2 semantic elements in a barebone "Hello World" implementation:
console.log
HELLO_WORLD
Since every coding style can abstract away data into a parameter or variable, there is no point for us to show that. All implementations assume HELLO_WORLD
is a constant that is always inlined. This way it reduces the variations we need to present. (To make an anology, if we were to implement incrementByOne
, would we need to inline the number 1
or pass it in as parameter?)
CAVEAT/LIMITATION: All implementations also assume console
is static global. In case of functional programming, console.log
is asumed to be a function that can be passed around without further modification. (This is not the case in the browser, but that can be resolved with console.log.bind(console)
)
// _____ __ _ _ | |
///__ \_ _ _ __ ___/ _\ ___ _ __(_)_ __ | |_ | |
// / /\/ | | | '_ \ / _ \ \ / __| '__| | '_ \| __| | |
// / / | |_| | |_) | __/\ \ (__| | | | |_) | |_ | |
// \/ \__, | .__/ \___\__/\___|_| |_| .__/ \__| | |
// |___/|_| |_| | |
//Typescript Cheat Sheet: every syntax feature exemplified | |
//variables are the same as javascript, but can be defined with a type: | |
var myString:string; |
<?php | |
/** | |
* Plugin Name: entry-points-<author> | |
*/ | |
// Menu entry points | |
add_action( 'admin_menu', 'i_need_your_callback_selection' ); | |
function <author>_entry_points_add_admin_menu() { |
<?php | |
//////////////////////////// | |
# WP AJAX EXAMPLE | |
//////////////////////////// | |
///////////////////////// | |
# Enqueue Script | |
///////////////////////// |
<?php | |
/** | |
* WordPress AJAX Frontend Execution. | |
* | |
* Using WP Ajax should not be used from the frontend because response | |
* from `admin-ajax.php` are not cached (including `nocache_headers()`). | |
* Instead, you should add a query var, and then do the `template_include` | |
* routine to select a template that returns JSON. | |
* | |
* A side benefit here is that it makes your site more RESTful. |
""" | |
A deep neural network with or w/o dropout in one file. | |
License: Do What The Fuck You Want to Public License http://www.wtfpl.net/ | |
""" | |
import numpy, theano, sys, math | |
from theano import tensor as T | |
from theano import shared | |
from theano.tensor.shared_randomstreams import RandomStreams |
<?php | |
$category = 8; | |
$data = array( | |
164, 150, 132, 144, 125, 149, 145, 146, | |
158, 140, 147, 136, 148, 152, 144, 168, | |
126, 138, 176, 163, 119, 154, 165, 146, | |
173, 142, 147, 135, 153, 140, 135, 161, | |
145, 135, 142, 150, 156, 145, 128, 157 | |
); | |
$min = min($data); |