Skip to content

Instantly share code, notes, and snippets.

fly like a bird ...


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 gist:397eb5cc0209dd8f52a07ba97593d28e
$arr = array(
array('a', '1'),
array('b', '2'),
// klasicky
$out = array();
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
<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;
View decorator-nette.php
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
<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>
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
// 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
class Permissions {
const ADD_CONTENT = 0x1;
const ADD_OWN_CONTENT = 0x2;
const EDIT_CONTENT = 0x4;
const EDIT_OWN_CONTENT = 0x8;
const DELETE_CONTENT = 0x10;
Kcko / bitwise-permission-checking.php
Created Mar 22, 2019 — forked from phnah/bitwise-permission-checking.php
Check permission using bitwise operators
View bitwise-permission-checking.php
Initially, I found bitmasking to be a confusing concept and found no use for it. So I've whipped up this code snippet in case anyone else is confused:
// The various details a vehicle can have
$hasFourWheels = 1;
$hasTwoWheels = 2;
$hasDoors = 4;
$hasRedColour = 8;
You can’t perform that action at this time.