Skip to content

Instantly share code, notes, and snippets.

View Samuyi's full-sized avatar
🎯
Focusing

Samuyi Obasuyi Samuyi

🎯
Focusing
  • Far Away
View GitHub Profile
@Samuyi
Samuyi / nginx.conf
Created January 20, 2019 13:39 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@Samuyi
Samuyi / sales_func.sql
Last active January 7, 2019 12:01
Potgresql stored function example
CREATE FUNCTION sales_func(employee_id int, vehicle_id int)
RETURNS SETOF sales
AS $$
DECLARE
car_model text;
car_price int;
sales_bonus int;
bonus int;
BEGIN
EXECUTE 'SELECT model, sales_bonus, price FROM cars WHERE car_id = $1'
@Samuyi
Samuyi / flattener.js
Last active December 6, 2017 00:04
Flatten arrays with javascript
function flattener(array, newArray=[]) {
// test if parameters supplied is an array
if (!Array.isArray(array) && !Array.isArray(newArray)) {
throw new Error('parameters must be arrays!');
}
// loop through the array
for (let i = 0; i < array.length; ++i) {
// check if element at index i is an array
if (Array.isArray(array[i])) {
// if element at index i is an array recursively call flattener function if true
@plentz
plentz / nginx.conf
Last active May 17, 2024 09:08
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048