Skip to content

Instantly share code, notes, and snippets.

View mburakerman's full-sized avatar
💉

Mehmet Burak Erman mburakerman

💉
View GitHub Profile
@mburakerman
mburakerman / localStorage.js
Created February 11, 2017 17:00
An Overview of localStorage
/* WITH JSON */
// Create with JSON
var user = { name: 'Mehmet Burak Erman', age: 22 }
localStorage.setItem('user', JSON.stringify(user));
// Read
console.log( JSON.parse(localStorage.getItem('user')) );
// or
console.log( JSON.parse(localStorage.getItem('user')).name );
@mburakerman
mburakerman / lib.js
Created June 24, 2017 12:49
Node.js module exports and require
let person = {
age:23,
name:"Mehmet Burak Erman",
show: function() {
return this.name;
}
}
function foo() {
@mburakerman
mburakerman / .editorconfig
Created February 13, 2018 07:37
Editor Config file
root = true
# for all languages
[*]
indent_style = space
indent_size = 2
# for javascript
[*.js]
indent_style = space
@mburakerman
mburakerman / package.json
Last active April 6, 2018 08:54
Webpack 4 config.js (Postcss and Babel) 👌 The Simplest Usage 👌
{
"name": "webpack-postcss,
"version": "1.0.0",
"scripts": {
"start": "webpack-dev-server --open --mode development",
"build": "webpack -p"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
@mburakerman
mburakerman / es6.js
Last active April 19, 2018 12:18
Es6 In a Nutshell
// 1:)let
var name = "burak";
console.log(name);
//or use let
let name2 = "burak2";
console.log(name2);
// Why we would use let instead of var?
/* In js, there is global and local scope but js doesn't really have a
@mburakerman
mburakerman / defaultProps.jsx
Last active August 1, 2018 02:30
defaultProps ES6 Syntax in React.js
// https://github.com/facebook/react/issues/3725
...
static get defaultProps() {
return {
count:1
}
}
....
@mburakerman
mburakerman / gulpfile.js
Last active September 12, 2018 08:12
Getting Started with Gulp.js
/*
LIVE RELOAD ✔
SCSS TO CSS ✔
MINIFY CSS ✔
PREFIX CSS ✔
MINIFY JS ✔
TRANSPILE JS ✔
*/
var gulp = require("gulp");
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mburakerman
mburakerman / package.json
Last active June 12, 2019 14:58
Webpack 4 config.js (Stylus to CSS and Babel) 👌 The Simplest Usage 👌
{
"name": "webpack-stylus",
"version": "1.0.0",
"scripts": {
"start": "webpack-dev-server --open --mode development",
"build": "webpack -p"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",