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
var A = [ | |
[1, 2, 3, 4, 5, 6], | |
[7, 8, 9, 10, 11, 12], | |
[13, 14, 15, 16, 17, 18], | |
[19, 20, 21, 22, 23, 24], | |
[25, 26, 27, 28, 29, 30], | |
[31, 32, 33, 34, 35, 36] | |
]; | |
var depth = 0; |
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 | |
/** | |
* Switch ProcessWire templates directory on $_SERVER['HTTP_HOST']. Type the | |
* Hostname as key and the name of the new templates folder as value. | |
* | |
*/ | |
$config->templates = array( | |
'mobile.domain.dev' => 'templates-mobile', // domain => templates folder name |
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:text/html, <style type="text/css">.e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div class="e" id="editor"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("editor");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script> | |
<!-- | |
For other language: Instead of `ace/mode/ruby`, Use | |
Markdown -> `ace/mode/markdown` | |
Python -> `ace/mode/python` | |
C/C++ -> `ace/mode/c_cpp` | |
Javscript -> `ace/mode/javascript` | |
Java -> `ace/mode/java` | |
Scala- -> `ace/mode/scala` |
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
/** | |
* Generate all the possible combinations among a set of nested arrays. | |
* | |
* @param array $data The entrypoint array container. | |
* @param array $all The final container (used internally). | |
* @param array $group The sub container (used internally). | |
* @param mixed $val The value to append (used internally). | |
* @param int $i The key index (used internally). | |
*/ | |
function generate_combinations(array $data, array &$all = array(), array $group = array(), $value = null, $i = 0) |
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
// ==UserScript== | |
// @name TracksFlow Download | |
// @namespace https://github.com/sapphiriq/ | |
// @description Tracksflow content downloader | |
// @author Alexander Khorin <sapphiriq@gmail.com> | |
// @copyright Alexander Khorin, 2012-2013 | |
// @include http://tracksflow.com/* | |
// ==/UserScript== | |
(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
/** > placeholderize ['placeholdered' <- класс когда текст в инпуте из плейсхолдера] */ | |
(function($) { | |
var activeClass = 'placeholdered'; | |
$('[data-placeholder]').each(function(i) { | |
var placeholder = $(this).data('placeholder'); | |
if (this.value.length == 0) { | |
this.value = placeholder; | |
$(this).addClass(activeClass) | |
} | |
$(this) |
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
//returns an assoc array with bitRate (kbps) and sampleRate (hz) | |
function getMP3BitRateSampleRate($filename) | |
{ | |
if (!file_exists($filename)) { | |
return false; | |
} | |
$bitRates = array( | |
array(0,0,0,0,0), | |
array(32,32,32,32,8), |
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
function declOfNum(number, titles) { | |
cases = [2, 0, 1, 1, 1, 2]; | |
return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ]; | |
} | |
use: | |
declOfNum(count, ['найдена', 'найдено', 'найдены']); |
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
// Is the passed CSS property supported? | |
// eg. detectCSS('transition') | |
function detectCSS(prop){ | |
var | |
prop = prop.replace(/-(\w)/g,function(s,g){return g.toUpperCase()}), | |
pre = ',Icab,Khtml,Moz,Ms,O,Webkit'.split(','); | |
for (var i = 0; i < pre.length; ++i){ | |
if(i==1) | |
prop = prop.slice(0,1).toUpperCase() + prop.slice(1); |
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
/** | |
* Provides requestAnimationFrame in a cross browser way. | |
* @author paulirish / http://paulirish.com/ | |
*/ | |
if ( !window.requestAnimationFrame ) { | |
window.requestAnimationFrame = ( function() { | |
return window.webkitRequestAnimationFrame || |
NewerOlder