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
mysql -h host -u user_name -pPassword database < file.sql > output.log |
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
"use strict"; | |
var Timer = function () { | |
var _time = 0; | |
var _interval = {}; | |
return { | |
/** | |
* Starts timer | |
*/ | |
start: function () { |
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
/** | |
* Preload images | |
* | |
* @param {Array} images | |
*/ | |
window.preload_images = function (images) { | |
$(document).ready(function () { | |
$.each(images, function (index, image_url) { | |
var image = new Image(); | |
image.src = image_url; |
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
/** | |
* Hack to show placeholder image if original | |
* does not exist | |
* @example | |
* <img src="<here>" onerror="onImgError(this)"/> | |
* @param source | |
* @returns {boolean} | |
*/ | |
function onImgError(source) | |
{ |
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
#!/usr/bin/env bash | |
cd $1 | |
find . type f | grep mp3$ > mp3-files.txt | |
readarray -t files < mp3-files.txt | |
INDEX=0 | |
LENGTH=${#files[@]} |
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 | |
/** | |
* This theme using Timber as html-template engine | |
* See more https://github.com/jarednova/timber | |
* | |
*/ | |
if (!class_exists('Timber')){ | |
add_action( 'admin_notices', function(){ | |
echo '<div class="error"><p>Timber not activated. Make sure you activate the plugin in <a href="' . admin_url('plugins.php#timber') . '">' . admin_url('plugins.php') . '</a></p></div>'; |
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
Math.random().toString(36).substring(7); |
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
wget http://google.com.ua -e use_proxy=yes -e http_proxy=173.234.248.111:3128 |
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
# import (with pv) | |
pv db_dump.sql | mysql -u <user> -p'<password>' <database> > error.log | |
# import (without pv) | |
mysql -u <user> -p'<password>' <database> < db_dump.sql > error.log | |
# export | |
mysqldump -u <user> -h <host> -p'<password>' <database> | pv > db_dump.sql | |
# export with progress |
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 | |
# This script will find all *.gif in current directory | |
# and convert in to max height with aspect ratio and | |
# apply maximum optimization. | |
# ============================ | |
# You need to install `gifsicle` first | |
# Create dir if not exists |