Skip to content

Instantly share code, notes, and snippets.

@vienhoang
vienhoang / RouteClass.php
Last active August 29, 2015 14:00 — forked from dwightwatson/RouteClass.php
Laravel: Make the Controller title a little bit prettier
<?php
public function routeClass($separator = ' - ')
{
$routeArray = Str::parseCallback(Route::currentRouteAction(), null);
if (last($routeArray) != null) {
// Remove 'controller' from the controller name.
$controller = str_replace('Controller', '', class_basename(head($routeArray)));
@vienhoang
vienhoang / gist:dcd32bdcf866e6208c2c
Last active August 29, 2015 14:04
Sublime: Useful Shortcuts (PC)

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@vienhoang
vienhoang / gist:3f54031fa6dd4b9df2c8
Created August 5, 2014 12:32
WordPress: Search and replace quick guide
https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
Search and Replace WordPress script
- Copy the "Search-Replace-DB-master" folder to WordPress root
- Go to domainname.com/Search-Replace-DB-master/index.php
- Replace "domainname.com" with "localhost/stagedomain"
- Click "dry run" check the results, then "live run"
- Login at wp-admin and update permalinks settings. Refresh the page and everything should work.
- Remove the "Search-Replace-DB-master" folder
@vienhoang
vienhoang / gist:75de2be2d4d2ec24c11d
Created August 6, 2014 16:21
Bower: Quick Guide Setup
http://travismaynard.com/writing/getting-started-with-gulp
If node and npm is installed:
npm init | Create package json file for project Commands
bower init | Initialize Bower json file to make install dependcies for project easier for others
bower install #packageName | Install package
bower install jquery#versionNUmber | Install jQuery with a specific version
bower uninstall #packageName | Uninstall package
bower list --paths | List paths to use in project for installed packages
bowwer list | List installed package
@vienhoang
vienhoang / gist:cfb3f269bc891eaf4898
Created August 6, 2014 16:22
Gulp: Quick Guide Setup
http://travismaynard.com/writing/getting-started-with-gulp
If node and npm is installed:
npm init | Create package json file for project with dependecies
npm install --save-dev gulp | Install gulp in project with gulp dependencies save to package.json file
npm install gulp-less --save-dev | Install less module and save to json file
or
npm install gulp-sass --save-dev | Install sass module and save to json file
or all in one line
npm install gulp-jshint gulp-sass gulp-concat gulp-uglify gulp-rename --save-dev
@vienhoang
vienhoang / gist:e2e85dff439f1507f491
Created August 6, 2014 16:43
Gulp: Setup Gulp File
// Include gulp
var gulp = require('gulp');
// Include Our Plugins
var jshint = require('gulp-jshint');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
@vienhoang
vienhoang / gist:1c29b4d2902ca8bea48b
Created August 6, 2014 17:24
HTML: My Bootstrap Boilerplate
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--[if IE]>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<![endif]-->
@vienhoang
vienhoang / gulpfile.js
Created August 6, 2014 17:36
Gulp: Gulpfile with Bower and Bootstrap
// Include gulp
var gulp = require('gulp');
// Include Our Plugins
var jshint = require('gulp-jshint');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
@vienhoang
vienhoang / gist:77e2bc5df65cbc3bcc8b
Created August 7, 2014 08:19
SCSS: Quick guide
SASS variables can come in six different types:
numbers | $myVar: 25px;
strings | $myStr: "some text string";
colors | $myColor: blue;
booleans | $myBool: false;
nulls | $myVar: null;
lists | $myList: 1px solid black; / $myMargin: 10px 10px 20px 10px;
/***********************************************************************************************/
@vienhoang
vienhoang / gist:eba723de6c5657529e4f
Created August 7, 2014 10:28
CSS: Responsive video hack
/***********************************************************************************************/
/*
http://www.developerdrive.com/2012/07/adding-responsive-videos-to-your-design/
RESPONSIVE VIDEO HACK
*/
/***********************************************************************************************/
/*Restrict the width of videos*/
.video-wrapper {
width: 600px;
max-width: 100%;