- [TDD] Write tests and / or docs before the implementation (even for pet and proof-of-concept projects)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use chrono::{serde::ts_seconds, DateTime, Utc}; | |
use serde::{Deserialize, Serialize}; // 1.0.153 // 0.4.23 | |
#[derive(Debug, Serialize, Deserialize, PartialEq)] | |
#[serde(tag = "_type")] | |
pub enum Leave { | |
#[serde(rename = "administrative")] | |
Administrative { | |
id: u8, | |
user_id: u8, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run -it --rm \ | |
--name php74_composer \ | |
-v "$PWD":/usr/src/myapp \ | |
-w /usr/src/myapp \ | |
php:7.4.33-cli sh -c "pwd; apt-get update && apt-get install -y unzip; \ | |
curl https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer | php; \ | |
php composer.phar create-project --no-install --no-interaction --no-scripts --prefer-dist cakephp/app:\"3.6.5\" my_app_name; \ | |
cd my_app_name; \ | |
php ../composer.phar config --no-plugins allow-plugins.cakephp/plugin-installer true; \ | |
php ../composer.phar install --ignore-platform-reqs; \ |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
❯ cargo lipo | |
[INFO cargo_lipo::meta] Will build universal library for ["flutter_rust_bridge_example"] | |
[INFO cargo_lipo::lipo] Building "flutter_rust_bridge_example" for "aarch64-apple-ios" | |
Compiling cfg-if v1.0.0 | |
Compiling scopeguard v1.1.0 | |
Compiling lazy_static v1.4.0 | |
Compiling encoding_index_tests v0.1.4 | |
Compiling adler v1.0.2 | |
Compiling adler32 v1.2.0 | |
Compiling smallvec v1.7.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const path = require('path'); | |
const gulp = require('gulp'); | |
const Mem = require('gulp-mem'); | |
const data = require('gulp-data'); | |
const JSON5 = require('json5'); | |
const twig = require('gulp-twig'); | |
const bs = require('browser-sync').create(); | |
const sass = require('gulp-sass'); |
HOWTO: Create Your Own Self-Signed Certificate with Subject Alternative Names Using OpenSSL in Ubuntu Bash for Window
My main development workstation is a Windows 10 machine, so we'll approach this from that viewpoint.
Recently, Google Chrome started giving me a warning when I open a site that uses https and self-signed certificate on my local development machine due to some SSL certificate issues like the one below:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// index.js | |
const http = require('http'); | |
const kernel = require('@rezeus/kernel'); | |
require('./services_database'); | |
kernel.on('error', (err) => { | |
// TODO Handle error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
posts.scope('Post', '/:postId', compose([postMiddleware1, postMiddleware2, (post) => { | |
// get the 'postId' via `ctx.params` | |
post.get('ViewPost', '/', PostsController.view); | |
post.scope('Comments', '/comments', compose([postCommentMiddleware1, postCommentMiddleware2, (comments) => { | |
comments.get('Index', '/', compose([postCommentIndexMW, CommentsController.index])); | |
// also get the 'commentId' via `ctx.params` | |
comments.get('View', '/:commentId', CommentsController.view); | |
}])); | |
}])); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const EventEmitter = require('events'); | |
const Koa = require('koa'); | |
const mongoose = require('mongoose'); | |
// Excerpted from https://nodejs.org/dist/latest-v8.x/docs/api/events.html#events_events | |
class MyEmitter extends EventEmitter {} | |
const myEmitter = new MyEmitter(); | |
// Excerpted from https://mongoosejs.com/docs/index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Koa = require('koa'); | |
const mongoose = require('mongoose'); | |
// Excerpted from https://mongoosejs.com/docs/index.html | |
mongoose.connect('mongodb://localhost/test'); | |
var db = mongoose.connection; | |
db.on('error', console.error.bind(console, 'connection error:')); | |
db.once('open', function() { | |
// we're connected! | |
app.listen(3000); // Start listening here |
NewerOlder