Skip to content

Instantly share code, notes, and snippets.

View kosaikham's full-sized avatar

sai lao kham kosaikham

View GitHub Profile
@kosaikham
kosaikham / crypto-buffer.js
Created January 29, 2018 11:13 — forked from chris-rock/crypto-buffer.js
Encrypt and decrypt buffers in nodejs
// Part of https://github.com/chris-rock/node-crypto-examples
var crypto = require('crypto'),
algorithm = 'aes-256-ctr',
password = 'd6F3Efeq';
function encrypt(buffer){
var cipher = crypto.createCipher(algorithm,password)
var crypted = Buffer.concat([cipher.update(buffer),cipher.final()]);
return crypted;
@kosaikham
kosaikham / example.html
Created January 29, 2018 12:25 — forked from ezekg/example.html
Example of validating a node-locked license from an Electron app
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Node-locked License Validation Example</title>
</head>
<body>
<button type='button' id='validate-license'>
Validate License
</button>
@kosaikham
kosaikham / MainActivity.java
Created July 13, 2018 21:25 — forked from enginebai/MainActivity.java
Get the current location and display a marker on Google Map.
package com.enginebai.sample;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
@kosaikham
kosaikham / async-await.js
Created July 20, 2018 08:35 — forked from wesbos/async-await.js
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
@kosaikham
kosaikham / Google Map Marker LatLong
Created August 17, 2018 04:15 — forked from woodwardtw/Google Map Marker LatLong
A draggable Google Map marker that auto locates and updates on maker drag
<!DOCTYPE html>
<html>
<head>
<title>Geolocation</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
html, body {
height: 100%;
margin: 0px;
@kosaikham
kosaikham / Podcasts2018.md
Created November 21, 2018 03:29 — forked from adamayd/Podcasts2018.md
Web Development Podcasts for Beginners in 2018

Web Development Podcasts for Beginners in 2018

Commuting to work from east of Baltimore to Washington DC leaves a lot of time in the car. While driving to work one day early in my web development career, I wondered if there is such a thing as a web development podcast. How would you pull off live coding on a “radio” podcast. Well, you don’t. Well, sometimes they do, but the moral of the story is that I was shocked to find that not only are there web development podcasts, there are a lot of them and really good ones to boot. These podcasts have become staples to my learning and I recommend them to everyone who is just starting out. While there are plenty to listen to, I recommend starting with these. You’ll have plenty of time later to load up deep dives into the V8 JavaScript engine later.

Technology Podcasts

These podcasts are focused more on the technologies used in web development and their use cases.

Syntax - The new kid on the block and by far my favorite right now. Syn

@kangax's ES6 quiz, explained

@kangax created a new interesting quiz, this time devoted to ES6 (aka ES2015). I found this quiz very interesting and quite hard (made myself 3 mistakes on first pass).

Here we go with the explanations:

Question 1:
(function(x, f = () =&gt; x) {
@kosaikham
kosaikham / react-lifecycle-cheatsheet.md
Created December 9, 2018 21:08 — forked from bvaughn/react-lifecycle-cheatsheet.md
React lifecycle cheatsheet

React lifecycle cheatsheet

Method Side effects1 State updates2 Example uses
Mounting
componentWillMount Constructor equivalent for createClass
render Create and return element(s)
componentDidMount DOM manipulations, network requests, etc.
Updating
componentWillReceiveProps Update state based on changed props
@kosaikham
kosaikham / README-Template.md
Created January 25, 2019 03:35 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@kosaikham
kosaikham / project-ideas01.md
Created January 30, 2019 09:45 — forked from MWins/project-ideas01.md
Back end Projects - list

Project Ideas

Ok. I'm going to list off some ideas for projects. You will have to determine if any particular idea is good enough to include in a portfolio. These aren't creative ideas. They likely already exist. Some are way too advanced while others are simplistic.

I will recommend to post any project you make to github and make a github project page for it. Explain in as much detail as possible how you made it, how it can be improved etc. Document it.

If you pick an advanced idea, setup a development roadmap and follow it. This will show some project management skills.

Another piece of advice for those who are design challenged. Use different front end frameworks and use different themes for those frameworks to provide appealing designs without looking like yet another bootstrap site.