Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Buidling

Bruno Škvorc Swader

🏠
Buidling
View GitHub Profile
@Swader
Swader / sample.sql
Created Feb 14, 2014
Sample DB with test table and three sample rows
View sample.sql
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
DROP SCHEMA IF EXISTS `sample` ;
CREATE SCHEMA IF NOT EXISTS `sample` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;
USE `sample` ;
-- -----------------------------------------------------
-- Table `sample`.`test`
@Swader
Swader / class.ziparchive.php
Last active Aug 29, 2015
Agbonghama Collins' code for image scraper article
View class.ziparchive.php
<?php
class ZipImages
{
private $folder;
private $url;
private $html;
private $fileName;
private $status;
@Swader
Swader / FW Survey 2015.js
Last active Aug 29, 2015
Alternative embed code for Typeform, lets you use hidden fields in embed mode without server side tweaks. Relies on a #tf_container div being present in the body somewhere.
View FW Survey 2015.js
var formurl = "https://sitepoint.typeform.com/to/NfTGuu";
var formtitle = "Most Popular PHP Framework, 2015";
var tid = setInterval( function () {
if ( document.readyState !== 'complete' ) return;
clearInterval( tid );
var tfcon = document.getElementById('tf_container');
var el;
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) {
View keybase.md

Keybase proof

I hereby claim:

  • I am swader on github.
  • I am swader (https://keybase.io/swader) on keybase.
  • I have a public key whose fingerprint is FE15 423A 76B1 E9EA 4413 C91D 8339 09E8 D48B B7CC

To claim this, I am signing this object:

@Swader
Swader / npmsucks.php
Created Aug 23, 2014
NPM recursive installation fix
View npmsucks.php
<?php
$moduleName = getMissingModule();
while ($moduleName !== false) {
echo 'Installing '.$moduleName.'.\n';
shell_exec('npm install '.$moduleName.' --no-bin-link');
$moduleName = getMissingModule();
}
function tryRun() {
@Swader
Swader / a.php
Created Mar 22, 2015
todoist_sample.php
View a.php
$a = array(
0 => array(
'indent' => 1,
'name' => 'Inbox',
'color' => '#dddddd',
'is_deleted' => 0,
'collapsed' => 0,
'inbox_project' => true,
'archived_date' => null,
'item_order' => 0,
View qprw.php
$function = new Twig_SimpleFunction('qprw', function (array $replacements) {
parse_str($_SERVER['QUERY_STRING'], $qp);
foreach ($replacements as $k => $v) {
$qp[$k] = $v;
}
return '?'.http_build_query($qp);
});
@Swader
Swader / requirements.txt
Last active Aug 29, 2015
Requirements for PIP on ReadTheDocs
View requirements.txt
Babel==2.0
CommonMark==0.5.4
Jinja2==2.8
MarkupSafe==0.23
PyYAML==3.11
Pygments==2.0.2
Sphinx==1.3.1
sphinxcontrib-phpdomain==0.1.4
alabaster==0.7.6
argh==0.26.1
@Swader
Swader / Test
Created Apr 19, 2012
Trying out cocode.io
View Test
namespace cocode;
class Cocode {
private $_sMsg;
public function __construct($sMsg = '') {
if (!empty($sMsg)) {
$this->setMessage($sMsg);
}
}
@Swader
Swader / zf2selectDemo.php
Created Sep 10, 2012
ZF2 : Populating a select element
View zf2selectDemo.php
// Using Zend\Select form element
$oSelect = new Select('someName');
$oSelect->setAttribute('id', 'mySelect')->setLabel('This is a select box');
$aData = array(
'Option 1' => 'value1',
'Option 2' => 'value2',
array('label' => 'Option 3', 'selected' => true, 'value' => 'value3') // For default selection
);