This file contains hidden or 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
# This is AppleScript to play/pause player in VK.com or in Music.Yandex.ru | |
# Make it a Service (via Automator) and assign shortkey to call it. | |
# | |
# Look here: https://www.evernote.com/shard/s40/sh/a77fd23b-47f0-4b8d-a18f-6cea2c6dd4c4/389e1fe1622daff105433f75158bdd0d | |
# | |
# TODO: find a way to assign use <Play/Pause> key on keyboard to this shortcut | |
# + even better, if it would also listen to <Play/Pause> on my headphones cord (like iTunes) | |
# | |
# (c) Vladimir Mityukov, 2014 |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
</head> | |
<body> | |
<ul> | |
<li class="list-item">Item #1</li> |
This file contains hidden or 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
/** | |
* Pads string or number with symbols | |
* @param {string} paddingValue Padding string. E.g., "0000" | |
* @return {string} E.g., "0032" | |
*/ | |
String.prototype.paddingLeft = function (paddingValue) | |
{ | |
return String(paddingValue + this).slice(-paddingValue.length); | |
}; | |
/** |
This file contains hidden or 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
function findElementContains(elmName, needle) { | |
var foundTextNode = null; | |
var allElms = document.querySelectorAll("*"); | |
for (var i=0; i < allElms.length; i++) { | |
var allChildren = allElms[i].childNodes; | |
for (var j=0; j < allChildren.length; j++) { | |
if (allChildren[j].nodeType == 3 && allChildren[j].nodeValue.indexOf(needle) > -1) { // text node | |
foundTextNode = allChildren[j]; | |
break; |
This file contains hidden or 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
function substr_in_array(arr, str) | |
{ | |
return arr.some( function(v) { return str.indexOf(v) >= 0; } ); | |
} |
This file contains hidden or 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
# just put the following command to crontab. Let say, every 5 minutes: | |
flock -xn /tmp/laravel_queues.lockfile -c "/usr/bin/php /path/to/laravel/artisan queue:listen" |
This file contains hidden or 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
class ActivityRepositoryEloquent extends BaseRepository implements ActivityRepository | |
{ | |
// ... | |
public function insertMany($records) | |
{ | |
$searchFields = [ | |
'subdomain', | |
'element_type', | |
'element_id', |
This file contains hidden or 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
// ==UserScript== | |
// @name Search site with google | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author Kotique | |
// @match *food4vita.ru* | |
// @grant none | |
// ==/UserScript== |
This file contains hidden or 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 | |
function array_undot($dottedArray, $initialArray = []) | |
{ | |
// to make it recursive: | |
$dottedArray = array_dot($dottedArray); | |
foreach ($dottedArray as $key => $value) { | |
array_set($initialArray, $key, $value); | |
} |
This file contains hidden or 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 | |
function carbon($dateTime = null) | |
{ | |
if (is_null($dateTime)) { | |
return \Carbon\Carbon::now(); | |
} | |
if (is_numeric($dateTime)) { // timestamp is passed: | |
return \Carbon\Carbon::createFromTimestamp($dateTime); |
OlderNewer