Skip to content

Instantly share code, notes, and snippets.

View designviacode's full-sized avatar
🎯
Focusing

Manpreet Singh designviacode

🎯
Focusing
View GitHub Profile
@designviacode
designviacode / node_nginx_ssl.md
Created September 23, 2019 20:43 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to Digital Ocean 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

@designviacode
designviacode / hackathon_how_to.md
Created October 10, 2018 19:04 — forked from sergmetelin/hackathon_how_to.md
Hackathon Getting Started guide

Important Note before you start

As the EOSIO V1.3 was released this week we strongly do not recommend to use it for the hackathon. Please use EOSIO V1.2.5 to build your applications. To setup your EOSIO Developer Portal for correct version for the event, please click the following link: https://developers.eos.io/eosio-nodeos/v1.2.0/docs/?hackathon It will setup a special cookie in your browser making some modifications to the Developer Portal to make it suitable to work with EOSIO V1.2.5. If you done everything right, you will see an "#eoshackathon" label under the Developer Portal logo: logo.png

About EOSIO

The EOS.IO software introduces a new blockchain architecture designed to enable vertical and horizontal scaling of decentralized applications. This is achieved by creating an operating system-like construct upon which applications can be built. The software prov

@designviacode
designviacode / js-tricky-bits.md
Created July 30, 2018 13:59 — forked from amysimmons/js-tricky-bits.md
Understanding closures, callbacks and promises in JavaScript

#Understanding closures, callbacks and promises

For a code newbie like myself, callbacks, closures and promises are scary JavaScript concepts.

10 months into my full-time dev career, and I would struggle to explain these words to a peer.

So I decided it was time to face my fears, and try to get my head around each concept.

Here are the notes from my initial reading. I'll continue to refine them as my understanding improves.

@designviacode
designviacode / checkPawnedPasswords.php
Created February 22, 2018 14:25 — forked from JimWestergren/checkPawnedPasswords.php
Simple method to check the Pwned Passwords API using PHP
<?php
/**
* Simple method to use the API from https://www.troyhunt.com/ive-just-launched-pwned-passwords-version-2/
* Written by Jim Westergren and released to public domain
* @return int count
*/
function checkPawnedPasswords(string $password) : int
{
$sha1 = strtoupper(sha1($password));
$data = file_get_contents('https://api.pwnedpasswords.com/range/'.substr($sha1, 0, 5));
@designviacode
designviacode / ImageUploadComponent.jsx
Created January 23, 2018 12:13 — forked from hartzis/ImageUploadComponent.jsx
React Image Uploading Component with Image Preview
class ImageUpload extends Component {
constructor(props) {
super(props);
this.state = {
file: '',
imagePreviewUrl: ''
};
this._handleImageChange = this._handleImageChange.bind(this);
this._handleSubmit = this._handleSubmit.bind(this);
}
// Destructuring cleans it up a bit
const { postCatalogues, updateCatalogues } = this.props;
const { catalogueName, activeStatusValidation } = formValidation;
// Bail early
if (catalogueName || activeStatusValidation) return;
// Model the data to avoid a switch - this makes more sense to me - seems more clear - you could even take this out of
// this method completely and include it as a property on the React component, as you may end up with more than add and edit,
// and perhaps it will be needed elsewhere?
@designviacode
designviacode / README.md
Created November 5, 2017 22:48
Sequelize + Express + Migrations + Seed Starter
@designviacode
designviacode / MySQL_macOS_Sierra.md
Created November 4, 2017 00:48 — forked from nrollr/MySQL_macOS_Sierra.md
Install MySQL on Sierra using Homebrew

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :

@designviacode
designviacode / setup.md
Created November 4, 2017 00:48 — forked from shashankmehta/setup.md
Setup PHP and Composer on OSX via Brew

First install Brew on your MAC

  • Setup Brew: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • brew update
  • brew tap homebrew/dupes
  • brew tap homebrew/php
  • Install PHP 7.0.+ brew install php70
  • Install mcrypt: brew install mcrypt php70-mcrypt
  • Finally, install composer: brew install composer
export default class Api {
static headers() {
return {
Accept: "application/json",
"Content-Type": "application/json"
};
}
static get(route) {
return this.request(route, null, "GET");