Skip to content

Instantly share code, notes, and snippets.

@showroom101
showroom101 / package.json
Last active June 14, 2018 10:19
proxy blog :: runing project with config proxy with angular-cli project
...
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxy.conf.json",
"build": "ng build --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
...
@showroom101
showroom101 / proxy.conf.json
Created June 14, 2018 10:03
proxy blog :: configure a proxy for your API
{
"/api": {
"target": "http://localhost:4300",
"secure": false
}
}
@showroom101
showroom101 / app.service.ts
Last active June 14, 2018 10:17
proxy blog :: simple problem api calls with angular
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http'
import { Observable } from 'rxjs/Observable';
@Injectable()
export class AnnouncementService {
private myUrl = 'http://localhost:4300';
constructor(
private http: HttpClient
) { }
@showroom101
showroom101 / nginx-tuning.md
Created June 1, 2018 04:23 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@showroom101
showroom101 / add_contact.php
Last active November 18, 2019 08:44
ตัวอย่างการทำ CRUD ของ php สอนน้องๆ ปี2 รหัส 60
<?php
// เรียกใช้ไฟล์ เชื่อมต่อ database
include("connect_db.php");
// $insert_date = date("Y-m-d H:i:s");
$contact_name = $_POST['Name'];
$contact_email = $_POST['Email'];
$contact_phone = $_POST['Phone'];
$contact_message = $_POST['Message'];

Array<T>

Legend:

  • ✏️ method changes this.
  • 🔒 method does not change this.

Array<T>.prototype.*:

  • concat(...items: Array): T[] 🔒 ES3
@showroom101
showroom101 / environment.ts
Created November 1, 2017 03:47 — forked from ball6847/environment.ts
Enabling hot module replacement for angular cli project
// environments/environment.ts
export const environment = {
production: false,
hmr: true
};
@showroom101
showroom101 / GrayScale.css
Last active October 17, 2016 04:20 — forked from tonmanna/GrayScale.css
Css GrayScale website
img {
-moz-filter: grayscale(100%) !important; /* Chrome, Safari, Opera */
-o-filter: grayscale(100%) !important; /* Chrome, Safari, Opera */
-webkit-filter: grayscale(100%) !important; /* Chrome, Safari, Opera */
filter: grayscale(100%) !important;
}
p, h1, h2, h3, h4, body ,ol, ul, button, a , a:hover{
-moz-filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale") !important;
-o-filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale") !important;
-webkit-filter: grayscale(100%) !important;

What is your folder-structure preference for a large-scale Node.js project?

0: Starting from Rails

This is the reference point. All the other options are based off this.

|-- app
|   |-- controllers
|   |   |-- admin