This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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"); | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('[data-sortable]').sortable({ | |
axis: 'y', | |
update: function(event, ui) { | |
var data = { | |
model: $(this).data('model'), | |
sort: $(this).sortable('toArray') | |
} | |
$.ajax({ | |
type: 'POST', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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?"> | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$cities = array( | |
"" => "-- SEÇİNİZ --", | |
"ADANA" => "ADANA", | |
"ADIYAMAN" => "ADIYAMAN", | |
"AFYONKARAHİSAR" => "AFYONKARAHİSAR", | |
"AĞRI" => "AĞRI", | |
"AMASYA" => "AMASYA", | |
"ANKARA" => "ANKARA", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
countdown() | |
( | |
IFS=: | |
set -- $* | |
secs=$(( ${1#0} * 3600 + ${2#0} * 60 + ${3#0} )) | |
while [ $secs -gt 0 ] | |
do | |
sleep 1 & |
NewerOlder