Skip to content

Instantly share code, notes, and snippets.

@selahattinunlu
selahattinunlu / jr-du.go
Last active Mar 26, 2020
jr-du using go :))
View jr-du.go
package main
import (
"errors"
"fmt"
"io/ioutil"
"os"
"path"
)
View semantic-commit-messages.md

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

View country-data.json
[
{
"code": "AD",
"emoji": "🇦🇩",
"unicode": "U+1F1E6 U+1F1E9",
"name": "Andorra",
"title": "flag for Andorra",
"dialCode": "+376"
},
{
@selahattinunlu
selahattinunlu / webpack.config.js
Last active Jul 13, 2018
example for extend ionic/app-scripts/config/webpack.config.js
View 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 Feb 12, 2016
Basic Gulpfile - Sass
View gulpfile.js
var gulp = require('gulp'),
sass = require('gulp-sass');
var sassConfig = {
inputDirectory: 'resources/sass/**/*.scss',
outputDirectory: 'assets/css',
options: {
outputStyle: 'expanded'
}
}
View wp-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 Jan 28, 2016
Javascript Printf - (String Template ES5)
View printf.js
/**
* 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");
*
View jquery-ajax-global-setup.js
$(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 Jan 28, 2016
Jquery Global Ajax Error Handler (For Form Validation Messages)
View global-ajax-error-handler.js
/**********************************
--------------------
Sample Request
--------------------
$.ajax({
wrapperElement: $('form#wrapperElementClassOrId'),
url: url,
type: 'POST',
@selahattinunlu
selahattinunlu / sortable.js
Created Jan 26, 2016
jquery-ui sortable snippet
View sortable.js
$('[data-sortable]').sortable({
axis: 'y',
update: function(event, ui) {
var data = {
model: $(this).data('model'),
sort: $(this).sortable('toArray')
}
$.ajax({
type: 'POST',