Skip to content

Instantly share code, notes, and snippets.

View meeDamian's full-sized avatar
👨‍💻
Lightning Networking

Damian Mee meeDamian

👨‍💻
Lightning Networking
View GitHub Profile
@meeDamian
meeDamian / gist:2314288
Created April 5, 2012 21:27
karuzela marek
function karuzeluj(){
$('.carusel hgroup.selected').animate({opacity:0, left:'-100px'},500,function(){
$(this).removeClass('selected');
var $nxt = ($(this).next().length) ? $(this).next() : $(this).siblings(':first');
$nxt.animate({opacity:1,left:'200px'},700)
.addClass('selected');
});
}
@meeDamian
meeDamian / negative_mod.js
Created April 24, 2012 08:01
[ JS | fix ] Negative Modulo Fix
/*
* By default JS returns invalid modulo values for negative numbers,
* below line fixes this, by overriding default js mod function
*/
Number.prototype.mod=function(n){return((this%n)+n)%n;}
@meeDamian
meeDamian / jQuery_plugin_base.js
Created April 25, 2012 19:03
[ JS | template ] Base structure of jQuery plugin (with methods and options
(function($) {
/**
* IMPORTANTE!
* if you call methods via methods._methodName(); entire context is LOST,
* therefore you cannot reference to your object as `this`, so a good way
* to fix it is to call them like that:
* methods._private.call($(this)); // which will keep object as `this`
**/
// this object is available only inside of this function
var methods = {
@meeDamian
meeDamian / init.sql
Created May 4, 2012 12:25
[ MySQL | bugs ] Wyciąganie najnowszego rekordu z bazy danych
-- tabela
CREATE TABLE winners(
id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL,
cid BIGINT UNSIGNED NOT NULL, -- Contest ID - id konkursu
eid BIGINT UNSIGNED NOT NULL, -- Entry ID - id wpisu w tym konkursie
place INT NOT NULL, -- którym miejscem został oznaczony przez moderatora
uts DECIMAL(17,3) NOT NULL,
PRIMARY KEY(id)
);
var lightbulb = {
state: false,
turn: function( state ){
if( typeof(state)=="boolean" ) this.state = state;
else if( typeof(state)=="string" ) this.state = (state=="on") ? true : false;
}
};
@meeDamian
meeDamian / on_duplicate.sql
Created May 23, 2012 12:38
[ Mysql | hacks ] Easy updateing on duplicate
-- will work only if theres a key or unique of any kind
INSERT INTO tabela ( name, content )
VALUES
('jakasNazwa', 'Jakaś Wartość'),
('jakasNazwa2', 'Jakaś Wartość 2')
ON DUPLICATE KEY
UPDATE content = VALUES( content );
var context,
colors = ["red", "green", "blue", "yellow"],
viewport = {
width: 500,
height: 500,
x: 0,
y: 0
},
bigBlackThing = {
width: 160,
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:baselineAligned="false"
android:background="@drawable/background">
<RelativeLayout
android:layout_height="fill_parent"
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="square">37dp</dimen>
<dimen name="spacing">12dp</dimen>
</resources>
some.listener(function(description){
cookie.async.accessor({params:object}, function( cookie ) {
// tu dostaję wartość cookie
});
// a tu musze ją zwrócić
return cookie_value;
});