Skip to content

Instantly share code, notes, and snippets.

View keriati's full-sized avatar
👨‍💻
Working...

Attila Kerekes keriati

👨‍💻
Working...
View GitHub Profile
@keriati
keriati / example.js
Created June 22, 2012 20:27
Revealing module pattern
(function() {
var NS = {};
NS.Parent = function() {
var privateFoo = "Private foobar in Parent";
function _foo(data) {
console.log("foo: " + data);
console.log(privateFoo);
@keriati
keriati / jquery.draggable.js
Created July 30, 2012 12:11
Draggable without jQuery UI
(function($) {
$.fn.drags = function(opt) {
var $el;
opt = $.extend({handle: '', cursor: 'move', windowLock: true}, opt);
$el = ('' === opt.handle) ? this : this.find(opt.handle);
return $el
@keriati
keriati / gitexp.sh
Created August 7, 2012 10:02
Git export changed files
tar czf new-files.tar.gz `git diff --name-only [COMMIT]`
@keriati
keriati / rsync.sh
Created August 7, 2012 16:16
rsync folders with delete
rsync -rtv --exclude-from="/full/path/to/rsync-exclude.txt" --delete /source /destination > rsync-log.txt
@keriati
keriati / error.php
Created August 9, 2012 08:56
PHP errors on!
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
@keriati
keriati / patter.html
Created August 10, 2012 20:07
Input validation with patterns
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
.center {
text-align: center;
}
#myInput {
@keriati
keriati / test.html
Created August 12, 2012 19:31
Detect invalid characters
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
.center {
text-align: center;
}
#myInput {
@keriati
keriati / scrolling.html
Created August 20, 2012 19:59
Basic scrolling menu example
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
.hide {
display: none;
}
</style>
(function () {
$('h4 a').each(function() {
var $this = $(this),
content = $this.html(),
wordsArray = content.split(" "),
newcontent = [];
$this.html('');
$.each(wordsArray, function(i, e) {
@keriati
keriati / changeText.js
Created August 23, 2012 12:52
Change the text content in one element.
/**
* Change only the text content of some element
*
* @method changeText
* @param element {Object} Element
* @param text {String} New text
* @param prepend {Boolean} If set to true, the text will be prepended to the element
* @return {Boolean} True if the change was successfull, false if not
*/
function changeText(element, text, position) {