Skip to content

Instantly share code, notes, and snippets.

Avatar

Vượng Nguyễn nmvuong92

View GitHub Profile
@4sskick
4sskick / 'let' + 'const' equivalent in ES5
Created Sep 4, 2016
'let' + 'const' equivalent in ES5
View 'let' + 'const' equivalent in ES5
As we knew that 'let & const' are not coming in ES5, those are coming in ES6 since 2015.
So to make these work like in latest version ECMA Scripts 2015, we can define it by ourself.
'const' - ES6
const a = 1;
'const' - ES5
var a = (function(){
var a = 1;
return function(){
View Add_Existing_Project_To_Git.md

#Adding an existing project to GitHub using the command line

Simple steps to add existing project to Github.

1. Create a new repository on GitHub.

In Terminal, change the current working directory to your local project.

##2. Initialize the local directory as a Git repository.

git init
@ebidel
ebidel / handle_file_upload.php
Created Apr 18, 2012
Uploading files using xhr.send(FormData) to PHP server
View handle_file_upload.php
<?php
$fileName = $_FILES['afile']['name'];
$fileType = $_FILES['afile']['type'];
$fileContent = file_get_contents($_FILES['afile']['tmp_name']);
$dataUrl = 'data:' . $fileType . ';base64,' . base64_encode($fileContent);
$json = json_encode(array(
'name' => $fileName,
'type' => $fileType,
'dataUrl' => $dataUrl,