Skip to content

Instantly share code, notes, and snippets.

View ron4stoppable's full-sized avatar
😎

Rohan Shewale ron4stoppable

😎
View GitHub Profile
@ron4stoppable
ron4stoppable / _imageOutlineComp.css
Created December 30, 2016 07:04
border (frame) overlay and inset on image
div.ie-container {
display: inline-block;
position: relative;
}
div.ie-container:before {
display: block;
content: '';
position: absolute;
top: 4px;
@ron4stoppable
ron4stoppable / serialObj.js
Created November 10, 2016 13:44
Serialize form data to object [jQuery]
// serializing the inputs to object
$.fn.serializeObject = function()
{
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
@ron4stoppable
ron4stoppable / httpd-vhosts.cofig
Created October 4, 2016 06:43
Virtual host configuration for Apache, with example from Windows environment
# Virtual host configuration for apache
# Windows location : C:\xampp\apache\config\extra\httpd-vhosts.config
#
# incase you have installed in some other stack or installed in other location, find in appropriate directory
#
# after setting up the httpd-vhosts.config, add the site name to hosts file located at
# 'C:\Windows\System32\drivers\etc\hosts' , it is a text file with no extension, if it do not exist, create the file.
# and your site's name at the end of it -
# 127.0.0.1 laravel.dev
# 127.0.0.1 mysite.dev
@ron4stoppable
ron4stoppable / get-db.php
Created September 16, 2016 11:53
Detect and connect to db server with proper configuration. The code check if the web app is hosted at localhost or a web server and load proper db configuration.
$local = array(
'127.0.0.1',
'::1'
); // localhost
if(!in_array($_SERVER['REMOTE_ADDR'], $local)){
require_once('connection-db.php'); // db connection details for server
}
else{
require_once('db-connect-local.php'); // db connection details for localhost
function onEdit(e){
var range = e.range;
range.setNote('Last modified: ' + new Date());
}
@ron4stoppable
ron4stoppable / db-connect-test.php
Last active April 28, 2016 13:36 — forked from chales/db-connect-test.php
Script for a quick PHP MySQL DB connection test.
<?php
# $ php -f db-connect-test.php
# a quick and easy script for db connectivity
$dbname = 'name'; // DB name
$dbuser = 'user'; // user name
$dbpass = 'pass'; // password
$dbhost = 'host'; // host
$connect = mysql_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
@ron4stoppable
ron4stoppable / style-fixture.css
Created April 23, 2016 18:12
Most web browsers these days do not explicitly handle html text styling - SUB, SUP, B, I and so on - they (kinda sorta) are converted into SPAN elements with appropriate CSS properties, and the rendering engine only deals with that.
/*
* Most web browsers these days do not explicitly handle
* html text styling - SUB, SUP, B, I and so on - they (kinda
* sorta) are converted into SPAN elements with appropriate CSS
* properties, and the rendering engine only deals with that.
*
*/
/* B for bold */
.bold {
@ron4stoppable
ron4stoppable / Migration Create Sessions
Last active June 28, 2018 11:07 — forked from harris21/Migration Create Sessions
Create CodeIgniter Sessions Migration
class Migration_Create_Sessions extends CI_Migration {
// The session table structure changed for CI 3.0
public function up()
{
$fields = array(
'id VARCHAR(40) DEFAULT \'0\' NOT NULL',
'ip_address VARCHAR(45) DEFAULT \'0\' NOT NULL',
'timestamp INT(10) unsigned DEFAULT 0 NOT NULL',
'data blob NOT NULL'
@ron4stoppable
ron4stoppable / migration create session
Created April 21, 2016 13:09
CI 3.0 Migrations to Create Session
<?php
class Migration_Create_Sessions extends CI_Migration {
public function up()
{
$fields = array(
'id VARCHAR(40) DEFAULT \'0\' NOT NULL',
'ip_address VARCHAR(45) DEFAULT \'0\' NOT NULL',
'timestamp INT(10) unsigned DEFAULT 0 NOT NULL',
/*
* Dabblet: Font Awesome Icon test
*/
@import url(https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css);
/* just to center align div */
.row{
width: 100%;
text-align: center;
}
.cols{