Skip to content

Instantly share code, notes, and snippets.

🐦
fly like a bird ...

Kcko

🐦
fly like a bird ...
Block or report user

Report or block Kcko

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View example.sql
-- 1
SET @table = "pexeso";
SET @sql:= CONCAT('SELECT * FROM',' ', @table);
PREPARE stmt FROM @sql;
EXECUTE stmt;
-- DEALLOCATE PREPARE stmt; # neni povinne
-- 2, Dynamically Building SQL based on Parameters
CREATE DEFINER=`root`@`localhost`
PROCEDURE `GetRecentActivity`(input VARCHAR(15))
View clanky.sql
CREATE TRIGGER diskuse_ai AFTER INSERT ON diskuse FOR EACH ROW UPDATE clanky SET diskuse_pocet = diskuse_pocet + 1 WHERE id = NEW.clanek;
CREATE TRIGGER diskuse_ad AFTER DELETE ON diskuse FOR EACH ROW UPDATE clanky SET diskuse_pocet = diskuse_pocet - 1 WHERE id = OLD.clanek;
CREATE TRIGGER diskuse_au AFTER UPDATE ON diskuse FOR EACH ROW UPDATE clanky SET diskuse_pocet = diskuse_pocet + IF(id = NEW.clanek, 1, -1) WHERE id = OLD.clanek XOR id = NEW.clanek;
View example.scss
// 1)
@mixin test($val) {
width: $val;
height: $val;
@if $val > 0 {
@include test($val - 1);
}
}
View DefaultSettings.php
<?php
namespace Andweb\Yml;
use Nette;
class DefaultSettings
{
use Nette\SmartObject;
protected $arr;
View config.neon
services:
- Config
reCaptcha:
siteKey: @Config::getSiteKey()
secretKey: @Config::getSecretKey()
methodName: 'addReCaptcha' # optional
View promises.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.js'></script>
</head>
<body>
View factory.php
<?php
$arr = [
'company' => 'AMI',
'employeeCount' => 25,
'years' => 12,
'bankInfo' => [
'account' => 'xxxx',
'money' => '2 billions'
View caching.js
function Selector_Cache() {
var collection = {};
function get_from_cache( selector ) {
if ( undefined === collection[ selector ] ) {
collection[ selector ] = $( selector );
}
return collection[ selector ];
}
return { get: get_from_cache };
}
View gist:397eb5cc0209dd8f52a07ba97593d28e
<?php
$arr = array(
array('a', '1'),
array('b', '2'),
);
// klasicky
$out = array();
@Kcko
Kcko / gist:b368919a7cbfb8b120e4cd9766083044
Created Apr 30, 2019 — forked from ethanpil/gist:8675160
Insert A Random String from List in MySQL
View gist:b368919a7cbfb8b120e4cd9766083044
UPDATE tablename
SET columnname = ELT(0.5 + RAND() * 6, 'value 1','value 2','value 3','value 4','value 5','value 6')
You can’t perform that action at this time.