Skip to content

Instantly share code, notes, and snippets.

@selahattinunlu
selahattinunlu / timer.sh
Created June 30, 2014 16:54
Tinker App Android'e gelene kadar idare edicez :)
#!/bin/bash
countdown()
(
IFS=:
set -- $*
secs=$(( ${1#0} * 3600 + ${2#0} * 60 + ${3#0} ))
while [ $secs -gt 0 ]
do
sleep 1 &
<?php
$cities = array(
"" => "-- SEÇİNİZ --",
"ADANA" => "ADANA",
"ADIYAMAN" => "ADIYAMAN",
"AFYONKARAHİSAR" => "AFYONKARAHİSAR",
"AĞRI" => "AĞRI",
"AMASYA" => "AMASYA",
"ANKARA" => "ANKARA",
-- Adminer 4.2.1 MySQL dump
SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS `cities`;
CREATE TABLE `cities` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
@selahattinunlu
selahattinunlu / jquery.oncssanimationend.js
Created July 3, 2015 19:11
Detecting CSS Animation and Transition End with JavaScript [http://osvaldas.info]
// http://osvaldas.info/detecting-css-animation-transition-end-with-javascript
/*
By Osvaldas Valutis, www.osvaldas.info
Available for use under the MIT License
*/
;( function( $, window, document, undefined )
{
var s = document.body || document.documentElement, s = s.style, prefixAnimation = '', prefixTransition = '';
@selahattinunlu
selahattinunlu / fullstackradio.py
Created August 2, 2015 15:48
This is a Python script to download all podcasts on fullstackradio.com
from lxml import html
import requests
import sys
class App:
def __init__(self):
self.url = 'http://fullstackradio.com'
page = requests.get(self.url)
page_string = html.fromstring(page.text)
@selahattinunlu
selahattinunlu / laravel.js
Last active October 11, 2015 13:18 — forked from JeffreyWay/laravel.js
Want to send a DELETE request when outside of a form? This will handle the form-creation bits for you dynamically, similar to the Rails implementation. (Requires jQuery, but doesn't have to.)To use, import script, and create a link with the `data-method="DELETE"` attribute.
/*
Add csrf token inside meta tag named "csrf-token":
<meta name="csrf-token" content="{{ csrf_token() }}">
<a href="posts/2" data-method="delete"> <---- We want to send an HTTP DELETE request
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-confirm="Are you sure?">
*/
@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',
@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 / 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 / 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