Skip to content

Instantly share code, notes, and snippets.

@selahattinunlu
selahattinunlu / jr-du.go
Last active March 26, 2020 21:09
jr-du using go :))
package main
import (
"errors"
"fmt"
"io/ioutil"
"os"
"path"
)

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

[
{
"code": "AD",
"emoji": "🇦🇩",
"unicode": "U+1F1E6 U+1F1E9",
"name": "Andorra",
"title": "flag for Andorra",
"dialCode": "+376"
},
{
@selahattinunlu
selahattinunlu / webpack.config.js
Last active July 13, 2018 20:52
example for extend ionic/app-scripts/config/webpack.config.js
// don't forget to install "lodash" "dotenv"
var ionicWebpackConfig = require('@ionic/app-scripts/config/webpack.config.js');
var webpack = require('webpack');
var _ = require('lodash');
var dotenvConfig = require('dotenv').config();
var dev = ionicWebpackConfig.dev;
var prod = ionicWebpackConfig.prod;
var loadProcessEnvValues = function() {
@selahattinunlu
selahattinunlu / gulpfile.js
Created February 12, 2016 16:10
Basic Gulpfile - Sass
var gulp = require('gulp'),
sass = require('gulp-sass');
var sassConfig = {
inputDirectory: 'resources/sass/**/*.scss',
outputDirectory: 'assets/css',
options: {
outputStyle: 'expanded'
}
}
@selahattinunlu
selahattinunlu / wp-editorconfig
Created February 7, 2016 12:45
wordpress editorconfig
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/
root = true
[*]
charset = utf-8
end_of_line = lf
@selahattinunlu
selahattinunlu / printf.js
Created January 28, 2016 15:17
Javascript Printf - (String Template ES5)
/**
* Source: https://monocleglobe.wordpress.com/2010/01/12/everybody-needs-a-little-printf-in-their-javascript/
*
* Example:
* "{f} {b}".printf({f: "foo", b: "bar"});
*
* "%s %s".printf(["foo", "bar"]);
*
* "%s %s".printf("foo", "bar");
*
@selahattinunlu
selahattinunlu / jquery-ajax-global-setup.js
Created January 28, 2016 13:14
jquery-ajax-global-setup
$(document).ajaxError(function(event, xhr, settings) {
if (! settings.globalRequest) return;
var response = xhr.responseJSON;
switch (xhr.status) {
case 422:
$.each(response.error, function(key, errors) {
var input = $('[name="'+ key +'"]');
var wrapper = input.parents('.form-group, label');
@selahattinunlu
selahattinunlu / global-ajax-error-handler.js
Created January 28, 2016 12:31
Jquery Global Ajax Error Handler (For Form Validation Messages)
/**********************************
--------------------
Sample Request
--------------------
$.ajax({
wrapperElement: $('form#wrapperElementClassOrId'),
url: url,
type: 'POST',
@selahattinunlu
selahattinunlu / sortable.js
Created January 26, 2016 19:25
jquery-ui sortable snippet
$('[data-sortable]').sortable({
axis: 'y',
update: function(event, ui) {
var data = {
model: $(this).data('model'),
sort: $(this).sortable('toArray')
}
$.ajax({
type: 'POST',