Skip to content

Instantly share code, notes, and snippets.

@vienhoang
vienhoang / RouteClass.php
Last active Aug 29, 2015 — forked from dwightwatson/RouteClass.php
Laravel: Make the Controller title a little bit prettier
View RouteClass.php
<?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 Aug 29, 2015
Sublime: Useful Shortcuts (PC)
View gist:dcd32bdcf866e6208c2c

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 Aug 5, 2014
WordPress: Search and replace quick guide
View gist:3f54031fa6dd4b9df2c8
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
View gist:75de2be2d4d2ec24c11d
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
View gist:cfb3f269bc891eaf4898
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
View gist:e2e85dff439f1507f491
// 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 Aug 6, 2014
HTML: My Bootstrap Boilerplate
View gist:1c29b4d2902ca8bea48b
<!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 Aug 6, 2014
Gulp: Gulpfile with Bower and Bootstrap
View gulpfile.js
// 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');
View gist:77e2bc5df65cbc3bcc8b
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 Aug 7, 2014
CSS: Responsive video hack
View gist:eba723de6c5657529e4f
/***********************************************************************************************/
/*
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%;
You can’t perform that action at this time.