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
.boxsizingBorder { | |
-webkit-box-sizing: border-box; | |
-moz-box-sizing: border-box; | |
box-sizing: border-box; | |
} |
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 windowOpener(windowHeight, windowWidth, windowName, windowUri) | |
{ | |
var centerWidth = (window.screen.width - windowWidth) / 2; | |
var centerHeight = (window.screen.height - windowHeight) / 2; | |
newWindow = window.open(windowUri, windowName, 'resizable=0,width=' + windowWidth + | |
',height=' + windowHeight + | |
',left=' + centerWidth + | |
',top=' + centerHeight); |
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
<style> | |
.marked{ | |
background-color: #FEE65F; | |
display: inline-block; | |
position: relative; | |
top: -1px; | |
} | |
</style> | |
<script> |
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
smart_ajax({ | |
url: document.location.href, | |
type: 'POST', | |
data: q, | |
dataType: 'json', | |
error: function(){ alert('Error while trying to connect to server') }, | |
success: function(json){ | |
if(json.ok == true){ | |
}else{ |
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 | |
class a | |
{ | |
var $arr = array(); | |
function set() | |
{ | |
$args = func_get_args(); | |
$last = array_pop( $args ); |
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
$.fn.isOnScreen = function(){ | |
var win = $(window); | |
var viewport = { | |
top : win.scrollTop(), | |
left : win.scrollLeft() | |
}; | |
viewport.right = viewport.left + win.width(); | |
viewport.bottom = viewport.top + win.height(); |
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 foo(a, b) | |
{ | |
a = typeof a !== 'undefined' ? a : 42; | |
b = typeof b !== 'undefined' ? b : 'default_b'; | |
... | |
} |
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
recurse_func = function(arr, callback, delay) { | |
if (typeof(callback) == "function") { | |
delay = delay || 200; | |
var self = arr, idx = 0; | |
setInterval(function() { | |
callback(self[idx], idx); | |
idx = (idx+1 < self.length) ? idx+1 : 0; | |
}, delay); | |
} |
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
$ ulimit -n | |
4096 | |
$ ulimit -n 8192 | |
bash: ulimit: open files: cannot modify limit: Operation not permitted | |
$ sudo bash | |
# ulimit -n | |
4096 | |
# ulimit -n 8192 | |
# su - normaluser | |
$ ulimit -n |
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
var connection = new WebSocket('ws://127.0.0.1:1337'); | |
connection.onopen = function () { | |
// first we want users to enter their names | |
input.removeAttr('disabled'); | |
status.text('Choose name:'); | |
}; | |
connection.onerror = function (error) { | |
// just in there were some problems with conenction... |