Skip to content

Instantly share code, notes, and snippets.

View rintoug's full-sized avatar

Rinto George rintoug

View GitHub Profile
@rintoug
rintoug / index.html
Created August 23, 2018 05:59
Show preview when select an image via file input
<html lang="en">
<head>
<title>Show preview when select an image via file input </title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<input type="file" name="image_file" id="image_file">
<br>
@rintoug
rintoug / scroll.js
Created August 12, 2018 06:31
How to fix div when browser scrolls?
jQuery(function($) {
function fixDiv() {
var $cache = $('#getFixed');
if ($(window).scrollTop() > 100)
$cache.css({
'position': 'fixed',
'top': '10px'
});
else
$cache.css({
@rintoug
rintoug / upload.php
Created February 28, 2018 12:49
Uploading files in PHP
<?php
//Here is our upload script resides
//Check whether the form really submits
if($_SERVER["REQUEST_METHOD"] == "POST"){
if(!empty($_FILES['image']['name'])) {
$uploadDir = './uploads/';
$uploadFilename = $uploadDir.basename($_FILES['image']['name']);
//Check extension
$ext = pathinfo($filename, PATHINFO_EXTENSION);
@rintoug
rintoug / index.html
Created February 28, 2018 12:47
Uploading files in PHP
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>File Upload Form</title>
</head>
<body>
<form action="upload.php" method="post" enctype="multipart/form-data">
<div class="form-control">
@rintoug
rintoug / Contact.php
Last active February 25, 2018 04:46
How to Create a Contact Form In CodeIgniter
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Contact extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
@rintoug
rintoug / contactform.php
Created February 24, 2018 17:52
How to Create a Contact Form In CodeIgniter
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../../../favicon.ico">
@rintoug
rintoug / Controller.php
Last active December 19, 2017 17:28
How to get Query Strings Value from a URL in Laravel
public function posts(Request $request) {
$id = $request->input('id'); //returns Ony Id value
$query = $request->all(); //Returns all inputs
//Another way to do it
$id = Input::get('id'); //returns Ony Id value
$query = Input::all(); //Returns all inputs
@rintoug
rintoug / functions.php
Created June 6, 2017 09:56
Adding CSS to WordPress Theme Via functions.php File
<?php
// Load the theme stylesheets
function active_theme_styles()
{
// Load all of the styles that need to appear on all pages
wp_enqueue_style( 'custom', get_stylesheet_directory_uri() . '/css/custom.css' );
// Conditionally load some thing in the home page
wp_register_style( 'slideshow', get_stylesheet_directory_uri() . '/css/slideshow.css' );
@rintoug
rintoug / view.php
Created June 4, 2017 08:17
How to do Pagination in CodeIgniter
<div id="body">
<?php
foreach($countries as $country) {
echo $country['country_name'] . " - " . $country['country_code'] . "<br>";
}
?>
<p><?php echo $links; ?></p>
</div>
@rintoug
rintoug / Controller.php
Created June 4, 2017 08:16
How to do Pagination in CodeIgniter
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Country extends CI_Controller {
public function __construct()
{
parent:: __construct();
$this->load->model('Country_model', 'country');
$this->load->library("pagination");