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 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')
View example.html
<html>
<head>
<link rel="stylesheet" type="text/css" href="url_style.css">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
function changeurl(url)
{
var new_url="/Your URL/"+url;
window.history.pushState("data","Title",new_url);
document.title=url;
View decorator-nette.php
<?php
# https://forum.nette.org/cs/31783-mazanie-suboru-po-samotnej-akcii-stiahnut-subor#p202279
use Nette\Application\Responses\FileResponse;
use Nette\Http\IRequest;
use Nette\Http\IResponse;
final class DownloadAndDeleteFileResponse implements Nette\Application\IResponse
{
private $response;
View fragment.txt
<tr>
<td rowspan=6 align="center" valign="middle"><font size=-2>1. KOLO</font></td>
<td align="center"><font size=-2>22.4.</font></td>
<td align="center"><font size=-2>17:00</font></td>
<td align="left"><font size=-2>BALKAN BOYS</font></td>
<td align="left"><font size=-2>FC FOFO</font></td>
<td align="right"><font size=-2><B>&nbsp;</B></font></td>
<td align="right"><font size=-2>&nbsp;</font></td>
<td align="left"><font size=-2>ODLOŽENO</font></td>
</tr>
View random-number-between.sql
-- For range (min..max( (min inclusive, max exclusive) it is:
FLOOR( RAND() * (max-min) + min )
-- For range (min..max) (min+max inclusive) it is:
FLOOR( RAND() * (max-min+1) + min )
View johny-ex.php
<?php
// For each flag, assign a power of two
// This makes a mask with a single bit turned on
$male = 1;
$bald = 2;
$tall = 4;
$funny = 8;
$fictitious = 16;
View permission.php
<?php
class Permissions {
const ADD_CONTENT = 0x1;
const ADD_OWN_CONTENT = 0x2;
const EDIT_CONTENT = 0x4;
const EDIT_OWN_CONTENT = 0x8;
const DELETE_CONTENT = 0x10;
You can’t perform that action at this time.