Skip to content

Instantly share code, notes, and snippets.

View mburakerman's full-sized avatar
💉

Mehmet Burak Erman mburakerman

💉
View GitHub Profile
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 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 / package.json
Last active September 26, 2022 17:32
Webpack 4 config.js (SCSS to CSS and Babel) 👌 The Simplest Usage 👌
{
"name": "webpack-sass",
"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 / 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 / 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");
@mburakerman
mburakerman / plugin.js
Last active July 28, 2023 07:07
The simplest vanilla js plugin template
// <div id="box">Lorem</div>
// Our goal is to make text color red
var Makered = function(selector) {
this.el = document.querySelector(selector); // for multiple elements use querySelectorAll
}
Makered.prototype.makered=function() {
this.el.style.color="red";
}
@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 / style.scss
Last active December 15, 2022 16:17
Usefull CSS/SASS Shortcuts for Everyday Front End Development
/// Mixin to prefix a property
/// @author Hugo Giraudel
/// @param {String} $property - Property name
/// @param {*} $value - Property value
/// @param {List} $prefixes (()) - List of prefixes to print
@mixin prefix($property, $value, $prefixes: ()) {
@each $prefix in $prefixes {
#{'-' + $prefix + '-' + $property}: $value;
}