Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>React strict mode test</title> | |
</head> | |
<body> | |
<div id="app"></div> |
const createId = (text = Date.now().toString().substring(0, 10)) => { | |
const m = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]; // 0 ~ 9 | |
let hash = ""; | |
for (let i = 0; i < text.length; i++) { | |
if (i > 6) { | |
hash += text[i]; | |
} else { | |
hash += m[Number(text[i])]; | |
} |
#!/bin/bash | |
# Functions ============================================== | |
# return 1 if global command line program installed, else 0 | |
# example | |
# echo "node: $(program_is_installed node)" | |
function program_is_installed { | |
# set to 1 initially | |
local return_=1 |
Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
<!-- Pagination Links --> | |
{% if paginator.total_pages > 1 %} | |
<div class="pagination"> | |
{% if paginator.previous_page %} | |
<a href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}">« Prev</a> | |
{% else %} | |
<span>« Prev</span> | |
{% endif %} | |
{% for page in (1..paginator.total_pages) %} |
// Include gulp | |
var gulp = require('gulp'); | |
// Include Our Plugins | |
var jshint = require('gulp-jshint'); | |
var sass = require('gulp-sass'); | |
var concat = require('gulp-concat'); | |
var uglify = require('gulp-uglify'); | |
var rename = require('gulp-rename'); | |
var mocha = require('gulp-mocha'); |
module.exports = { | |
up: function (queryInterface, Sequelize) { | |
return [ | |
queryInterface.addColumn('User', 'name', { | |
type: Sequelize.STRING | |
}), | |
queryInterface.addColumn('User', 'nickname', { | |
type: Sequelize.STRING, | |
}) | |
]; |
module.exports = { | |
up: function (queryInterface, Sequelize) { | |
// raw query | |
// add column and foreign key constrant | |
var sql = "ALTER TABLE `Friend`" + | |
" ADD COLUMN `UserId` BIGINT(20) UNSIGNED DEFAULT NULL" + | |
", ADD CONSTRAINT `fkUserIdInFriend` FOREIGN KEY (`UserId`) REFERENCES `User` (`id`) ON UPDATE CASCADE ON DELETE RESTRICT"; | |
// run the query | |
return queryInterface.sequelize.query(sql, { |
<?php | |
function sanitize_filename_on_upload($filename) { | |
$ext = end(explode('.', $filename)); | |
// Replace all weird characters | |
$sanitized = preg_replace('/[^a-zA-Z0-9-_.]/', '_', substr($filename, 0, -(strlen($ext)+1))); | |
// Replace dots inside filename | |
$sanitized = str_replace('.', '-', $sanitized); |
var morgan = require('morgan'); | |
/** | |
* morgan wrapper | |
* @returns {morgan} | |
*/ | |
module.exports = function setLogger() { | |
// http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html | |
var red = '\x1B[31m', | |
green = '\x1B[32m', |