Skip to content

Instantly share code, notes, and snippets.

@ozanmuyes
ozanmuyes / main.rs
Created March 13, 2023 06:56
Rust Serde Test
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,
@ozanmuyes
ozanmuyes / create-project.sh
Last active January 18, 2023 03:47
CakePHP via Docker
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.
❯ 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
@ozanmuyes
ozanmuyes / Advices for Sustainable and Maintainable Codebase.md
Created May 18, 2022 00:39
Advices for Sustainable and Maintainable Codebase

Advices for Sustainable and Maintainable Codebase

  • [TDD] Write tests and / or docs before the implementation (even for pet and proof-of-concept projects)
@ozanmuyes
ozanmuyes / gulpfile.js
Last active October 17, 2019 00:17
gulpfile for Gulp 4 to ease development of website with Twig, SCSS and Babel
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');
@ozanmuyes
ozanmuyes / openssl.MD
Created July 24, 2019 11:48 — forked from jchandra74/openssl.MD
HOWTO: Create Your Own Self-Signed Certificate with Subject Alternative Names Using OpenSSL in Ubuntu Bash for Window

HOWTO: Create Your Own Self-Signed Certificate with Subject Alternative Names Using OpenSSL in Ubuntu Bash for Window

Overview

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:

Self-Signed SSL Issue in Chrome

@ozanmuyes
ozanmuyes / index.js
Last active February 19, 2019 16:04
A proper application code to start the server and a service to connect to the database
// index.js
const http = require('http');
const kernel = require('@rezeus/kernel');
require('./services_database');
kernel.on('error', (err) => {
// TODO Handle error
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);
}]));
}]));
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
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