Skip to content

Instantly share code, notes, and snippets.

View Kcko's full-sized avatar
🦜
fly like a bird ...

Roman Janko Kcko

🦜
fly like a bird ...
View GitHub Profile
@Kcko
Kcko / Delete from table with alias.sql
Last active August 29, 2015 14:01
Delete from table with alias
DELETE `cl`
FROM `ContentLink` `cl`
WHERE `cl`.`lorder` = 34;
@Kcko
Kcko / Easy Modal.html
Created May 24, 2014 20:01
Easy Modal by JacklMoore
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>jQuery Modal Demo</title>
<style>
* {
margin:0;
padding:0;
}
@Kcko
Kcko / toggle input value.js
Created May 26, 2014 10:02
Toogle input value -- better than placeholder (browser support)
$.fn.toggleInputValue = function(){
return $(this).each(function(){
var input = $(this);
var defaultValue = input.val();
input.focus(function() {
if(input.val() == defaultValue) input.val("");
}).blur(function(){
if(input.val().length == 0) input.val(defaultValue);
});
@Kcko
Kcko / Add cell description.js
Created May 26, 2014 10:18
Responsive tables (add cell description -- data attribute)
function pridatPopisky(el) {
var popisky = el.getElementsByTagName("th");
var radky = el.getElementsByTagName("tr");
for (var i = 1; i < radky.length; i++) {
var bunky = radky[i].getElementsByTagName("td");
for (var j = 0; j < bunky.length; j++) {
bunky[j].setAttribute("popisek", $(popisky[j]).html());
}
}
}
@Kcko
Kcko / checkbox-selectbox.html
Created June 3, 2014 17:02
Checkbox-selectbox (popupbox)
<!DOCTYPE html>
<html>
<head>
<style>
form {height:1.2em;border:1px solid black; overflow:hidden; float:left; padding-right:0.5em;}
form:hover, form:active {height:5.2em; overflow:scroll; overflow-x:hidden;}
</style>
</head>
<body>
<form>
@Kcko
Kcko / delete from table with limit.sql
Created June 3, 2014 20:53
Delete from table with limit (first X rows excluded)
DELETE FROM table
WHERE ID IN
(
SELECT ID
FROM
(
SELECT ID
FROM table
WHERE Type = 'TEST'
ORDER BY ID
@Kcko
Kcko / FooControl.php
Last active August 29, 2015 14:05 — forked from matej21/FooControl.php
Ukázková komponenta - attached
<?php
use Nette\Application\UI;
class FooControl extends UI\Control
{
public function __construct(...)
{
//predani parametru a zavislosti
}
@Kcko
Kcko / FTP.php
Last active August 29, 2015 14:05
FTP připojení a upload via PHP
$connection = ftp_connect($server);
$login = ftp_login($connection, $ftp_user_name, $ftp_user_pass);
if (!$connection || !$login) { die('Connection attempt failed!'); }
$upload = ftp_put($connection, $dest, $source, $mode);
if (!$upload) { echo 'FTP upload failed!'; }
@Kcko
Kcko / youtube-parser.php
Last active August 29, 2015 14:05
Youtube parser videa ( get info )
<?
//The Youtube's API url
define('YT_API_URL', 'http://gdata.youtube.com/feeds/api/videos?q=');
//Change below the video id.
$video_id = '66Wi3isw3NY';
//Using cURL php extension to make the request to youtube API
$ch = curl_init();
@Kcko
Kcko / drawingIntoImage.php
Last active August 29, 2015 14:05
Psaní do obrázků - PHP
<?php
$im = imagecreatefromjpeg("match-trailer.jpg");
$font = 'fonts/calibrib.ttf';
$fontNormal = 'fonts/calibri.ttf';
$teams = mb_strtoupper("FC Combix - FC Bohemians Praha B", 'UTF-8');