Skip to content

Instantly share code, notes, and snippets.

Summary: Useful Kubectl commands for deploying & managing apps in a Kubernetes cluster (Minikube as example)
@bradtraversy
bradtraversy / node_nginx_ssl.md
Last active July 22, 2024 05:09
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@nandorojo
nandorojo / react-native-file-upload.js
Created May 2, 2019 23:30
Upload a file to your server using react native / expo.
/*
IF YOU WANT TO UPLOAD ONE FILE, USE THE CODE BELOW.
SEE THE BOTTOM OF THE GIST TO SEE HOW TO UPLOAD MULTIPLE FILES.
HERE'S AN EXAMPLE SOMEONE MADE USING CLOUDINARY: https://gist.github.com/jamielob/5c1a5dc84e50e4507b71299d993dffec
*/
@valakirka
valakirka / banana_bread.md
Last active September 17, 2022 15:47
Banana bread

Banana bread

Ingredients

  • 3 very ripe bananas
  • 2 eggs
  • 220gr brown sugar
  • 8 tbsp butter
  • 250gr flour
  • 1 tsp backing powder
  • 1 tsp backing soda
  • A handful of chopped walnuts
@samundra
samundra / MakeSeedServiceProvider.php
Created February 12, 2017 09:56
Provides the "make:seeder" command in Lumen5.3.*
<?php
/**
* Filename: App/Providers/MakeSeedServiceProvider.php
*/
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Database\Console\Seeds\SeederMakeCommand;
@jamielob
jamielob / upload.js
Created October 18, 2016 23:07 — forked from cmcewen/upload.js
Upload image from React Native to Cloudinary
var CryptoJS = require('crypto-js');
function uploadImage(uri) {
let timestamp = (Date.now() / 1000 | 0).toString();
let api_key = 'your api key'
let api_secret = 'your api secret'
let cloud = 'your cloud name'
let hash_string = 'timestamp=' + timestamp + api_secret
let signature = CryptoJS.SHA1(hash_string).toString();
let upload_url = 'https://api.cloudinary.com/v1_1/' + cloud + '/image/upload'
@stankusl
stankusl / excerpt.md
Created May 27, 2015 15:07
Text Excerpt PHP function

Function:

function shorten_text($text, $max_length = 140, $cut_off = '...', $keep_word = false)
{
    if(strlen($text) <= $max_length) {
        return $text;
    }

if(strlen($text) > $max_length) {

@brock
brock / nodereinstall.sh
Last active June 13, 2024 12:20
Complete Node Reinstall. I've moved this to a repo at http://git.io/node-reinstall
#!/bin/bash
# node-reinstall
# credit: http://stackoverflow.com/a/11178106/2083544
## program version
VERSION="0.0.13"
## path prefix
PREFIX="${PREFIX:-/usr/local}"
@steveosoule
steveosoule / javascript-money-format.js
Created May 28, 2013 20:13
javascript-money-format.js
// Money Formatting
Number.prototype.formatMoney = function (c, d, t) {
var n = this,
c = isNaN(c = Math.abs(c)) ? 2 : c,
d = d == undefined ? "," : d,
t = t == undefined ? "." : t,
s = n < 0 ? "-" : "",
i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "",
j = (j = i.length) > 3 ? j % 3 : 0;
return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");