Skip to content

Instantly share code, notes, and snippets.

View cengkuru's full-sized avatar

cengkuru michael cengkuru

View GitHub Profile
@cengkuru
cengkuru / codeigniter .htaccess
Last active June 8, 2016 08:08
default codeigniter .htaccess to remove php extension
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !\.(css|gif|ico|jpg|js|png|swf|txt)$
RewriteCond $1 !^(index\.php|images|captcha|css|js|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ //index.php/$1 [L]
<Files "index.php">
AcceptPathInfo On
</Files>
@cengkuru
cengkuru / php expire session
Created June 8, 2016 08:07
expire session after 30 minutes
if (isset($_SESSION['LAST_ACTIVITY']) && (time() - $_SESSION['LAST_ACTIVITY'] > 1800)) {
// last request was more than 30 minutes ago
session_unset(); // unset $_SESSION variable for the run-time
session_destroy(); // destroy session data in storage
}
$_SESSION['LAST_ACTIVITY'] = time(); // update last activity time stamp
/*
You can also use an additional time stamp to regenerate the session ID periodically to avoid attacks on sessions like session fixation:
@cengkuru
cengkuru / changePageTitle.js
Created June 13, 2016 05:07
Dynamically change page title with angularJS
// It's very handy to add references to $state and $stateParams to the $rootScope
// so that you can access them from any scope within your applications.
// For example, <li ng-class="{ active: $state.includes('contacts.list') }">
// will set the <li> to active whenever 'contacts.list' or one of its
// decendents is active.
.run([ '$rootScope', '$state', '$stateParams',
function ($rootScope, $state, $stateParams) {
$rootScope.$state = $state;
$rootScope.$stateParams = $stateParams;
@cengkuru
cengkuru / README.md
Created June 13, 2016 05:46 — forked from zenorocha/README.md
A template for Github READMEs (Markdown) + Sublime Snippet

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

@cengkuru
cengkuru / README-Template.md
Created June 13, 2016 05:46 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisities

@cengkuru
cengkuru / npm-cheat-sheet.md
Created June 14, 2016 01:00 — forked from AvnerCohen/npm-cheat-sheet.md
Node.js - npm Cheat Sheet

Node.js - npm Cheat Sheet

(Full description and list of commands at - https://npmjs.org/doc/index.html)

##List of less common (however useful) NPM commands

######Prepand ./bin to your $PATH Make sure to export your local $PATH and prepand relative ./node_modules/.bin/:

@cengkuru
cengkuru / .env
Created June 28, 2016 06:17
Laravel email settings
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=wsfgeaudwccqgcoz
MAIL_ENCRYPTION=tls
@cengkuru
cengkuru / mail.php
Created June 28, 2016 06:26
mail settings laravel
<?php
return [
/*
|--------------------------------------------------------------------------
| Mail Driver
|--------------------------------------------------------------------------
|
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
@cengkuru
cengkuru / angular-loading-bar.css
Created June 29, 2016 11:05
angular loading bar and spinner css
/*!
* angular-loading-bar v0.9.0
* https://chieffancypants.github.io/angular-loading-bar
* Copyright (c) 2016 Wes Cruver
* License: MIT
*/
/* Make clicks pass-through */
#loading-bar,
#loading-bar-spinner {
@cengkuru
cengkuru / Git push deployment in 7 easy steps.md
Created June 30, 2016 05:24 — forked from thomasfr/Git push deployment in 7 easy steps.md
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook