Skip to content

Instantly share code, notes, and snippets.

View kenng's full-sized avatar
💭
calm

Ken Ng kenng

💭
calm
View GitHub Profile
@roipeker
roipeker / main.dart
Created September 3, 2020 00:27
Getx Subnavigators Colors
/// roipeker - 2020
/// Based on
/// https://medium.com/coding-with-flutter/flutter-case-study-multiple-navigators-with-bottomnavigationbar-90eb6caa6dbf
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class SampleMultiNavColors extends StatelessWidget {
@override
@avishayp
avishayp / Dockerfile
Created September 25, 2018 19:02
Add non-root user for alpine linux
# non root user example for alpine
#
# usage:
# $ docker build --build-arg "USER=someuser" --tag test .
# $ docker run --rm test
FROM alpine
ARG USER=default
ENV HOME /home/$USER
@GhazanfarMir
GhazanfarMir / Instructions.sh
Last active December 21, 2023 22:55
Install PHP7.2 NGINX and PHP7.2-FPM on Ubuntu 16.04
########## Install NGINX ##############
# Install software-properties-common package to give us add-apt-repository package
sudo apt-get install -y software-properties-common
# Install latest nginx version from community maintained ppa
sudo add-apt-repository ppa:nginx/stable
# Update packages after adding ppa
@jeffochoa
jeffochoa / Response.php
Last active April 20, 2024 12:35
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
@hiro88hyo
hiro88hyo / discord.md
Last active October 22, 2019 04:36
Instruction for Discord and Google Drive

Discord

Discord is a chat based sharing tool. You can talk with members, share the file, put the photos and so on.

I believe it is useful for idea sharing.

Create Account

  • Go to Official Site and Click "Login" button at the upper right of the site
  • Click "Register" at the bottom of "Login" button
  • Fill out valid E-mail address, username and password
@fideloper
fideloper / stream_file.php
Last active January 17, 2024 18:41
Stream file from S3 to browser, assume Laravel Filesystem usage
<?php
/*************************************************************************
* Get File Information
*/
// Assuming these come from some data source in your app
$s3FileKey = 's3/key/path/to/file.ext';
$fileName = 'file.ext';
@seoagentur-hamburg
seoagentur-hamburg / .htaccess
Last active March 31, 2024 00:01
UPDATE 2024/03: Perfect .htaccess file for highspeed and security. You can use it for every WordPress-Website without problems. Highspeed and Security - testet on hundreds of Websites. If you are using a WordPress Multisite, change the last part of this file.
########################################################################
# OPTIMAL .htaccess FILE FOR SPEED AND SECURITY @Version 2.0.9 - 03/2024
# ----------------------------------------------------------------------
# @Author: Andreas Hecht
# @Author URI: https://seoagentur-hamburg.com
# License: GNU General Public License v2 or later
# License URI: http://www.gnu.org/licenses/gpl-2.0.html
########################################################################
@rambabusaravanan
rambabusaravanan / lambda-email.py
Last active November 7, 2023 03:35
AWS Lambda Function to send SMTP Email
import smtplib
import os
def send_email(host, port, username, password, subject, body, mail_to, mail_from = None, reply_to = None):
if mail_from is None: mail_from = username
if reply_to is None: reply_to = mail_to
message = """From: %s\nTo: %s\nReply-To: %s\nSubject: %s\n\n%s""" % (mail_from, mail_to, reply_to, subject, body)
print (message)
try:
<?php
/**
* Automatically alias Laravel Model's to their base classname.
* Ex: "App\Models\User" now can just be accessed by "User"
*/
if (! function_exists('aliasModels')) {
function aliasModels() {
$finder = new \Symfony\Component\Finder\Finder();
$finder->files()->name('*.php')->in(base_path().'/app');
@dmnsgn
dmnsgn / listAllEventListeners.js
Created April 5, 2017 15:40
List all event listeners in a document
const listeners = (function listAllEventListeners() {
let elements = [];
const allElements = document.querySelectorAll('*');
const types = [];
for (let ev in window) {
if (/^on/.test(ev)) types[types.length] = ev;
}
for (let i = 0; i < allElements.length; i++) {
const currentElement = allElements[i];