Skip to content

Instantly share code, notes, and snippets.

View umanda's full-sized avatar
🎯
Focusing

Umanda Jayobandara umanda

🎯
Focusing
View GitHub Profile
@umanda
umanda / slim_project_init
Created August 28, 2015 05:22
Create Slim project structure in cmd
# mkdir -p slim_bloggin_app/{app/{routes,views},public/{css,js,img}} && cd slim_bloggin_app && touch app/bootstrap.php app/routes.php public/index.php public/.htaccess
# tree -a
.
├── .DS_Store
├── app
│ ├── bootstrap.php
│ ├── routes
│ ├── routes.php
│ └── views
@umanda
umanda / bs3-startup.html
Created August 28, 2015 05:39
bootstrap 3 html starter template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="description" content="">
<meta name="author" content="Umanda Jayobandara">
<link rel="shortcut icon" href="assets/images/ico/favicon.ico">
@umanda
umanda / 0_reuse_code.js
Last active August 29, 2015 14:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@umanda
umanda / unicode-detector.html
Last active August 29, 2015 14:13
Sinhala and English text detector
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Unicode detector</title>
<script>
function myFunction() {
var x = document.getElementById("frm1");
var data = "";
data = x.elements[0].value;
@umanda
umanda / Illegal-string-offset-Warning-PHP.php
Created February 16, 2015 11:22
Illegal string offset Warning PHP
function isset_get($array, $key, $default = null) {
return isset($array[$key]) ? $array[$key] : $default;
}
$myVar = isset_get($someArray, 'someKey');
//or with some default if you got one
$myVar = isset_get($someArray, 'someKey', $mydefault);
@umanda
umanda / user-extension.js
Created February 24, 2015 05:43
Custom function for selenium IDE. For install Option > Options > Add js path in Selenium core extension location To get selenium IDE Selenium IDE is only work for Firefox http://docs.seleniumhq.org/download/
var gotoLabels= {};
var whileLabels = {};
Selenium.prototype.reset = function() {
this.initialiseLabels();
this.defaultTimeout = Selenium.DEFAULT_TIMEOUT;
this.browserbot.selectWindow("null");
this.browserbot.resetPopups();
}
@umanda
umanda / HelloTest.php
Last active August 29, 2015 14:16
Set up PHPUnit in Windows + XAMPP + Eclips
<?php
class HelloTest extends \PHPUnit_Framework_TestCase {
public function testTrueIsTrue()
{
$foo = true;
$foo2 = false;
$this->assertTrue($foo);
$this->assertFalse($foo2);
}
}
@umanda
umanda / json_validate.php
Created March 23, 2015 10:33
Validate JSON String in PHP
/**
* Validate JSON String
* @param String $json
* @return boolean
*/
protected function isValidJson($json) {
json_decode($json);
return (json_last_error() == JSON_ERROR_NONE);
}
@umanda
umanda / demo.html
Last active August 29, 2015 14:20
Change the order of col-*-12 columns in Bootstrap 3 by using push/pull
<div class="row reorder-xs">
<div class="col-xs-12">
<p>test1</p>
</div>
<div class="col-xs-12">
<p>test2</p>
</div>
</div>
@umanda
umanda / menu.less
Last active August 29, 2015 14:27
BS3 menu seperate from boader
@darkred : #a70b0b;
.navbar-default{
.navbar-nav{
li:not(:last-child){
a{
.box-shadow (10px 0px 0px -9px @darkred;);
}
}
}