Skip to content

Instantly share code, notes, and snippets.

Vien Hoang vienhoang

Block or report user

Report or block vienhoang

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:7caf7dc564b67a8650c9
<meta http-equiv="Refresh" content="5;url=http://www.w3schools.com" />
@vienhoang
vienhoang / gist:5b5c422fcd318336381e
Last active Aug 29, 2015
jQuery: jQuery start, selfinvoking
View gist:5b5c422fcd318336381e
// Self invoking function, use $ for referencing jQuery so the $ don't clash with other libraries
(function($){
})(jQuery);
@vienhoang
vienhoang / gist:c91a9b816436fc667ad1
Created Oct 8, 2014
Angular: Directive controller
View gist:c91a9b816436fc667ad1
// Custom directive controller
app.directive("productPanels", function(){
return {
restrict: 'E',
templateUrl: 'product-panel.html'
controller: function() {
// Controller logic
},
controllerAs: 'panels'
@vienhoang
vienhoang / gist:fed87e9559c0432d7c75
Created Oct 8, 2014
Angular: Create a controller
View gist:fed87e9559c0432d7c75
app.controller("ProductController", function(){
this.
});
@vienhoang
vienhoang / gist:d19e9f4345a5f60443a2
Created Oct 8, 2014
Angular: Custom element directive
View gist:d19e9f4345a5f60443a2
// Custem element directive
app.directive("productDescription", function(){
return {
restrict: 'E',
templateUrl: 'product-description.html'
};
});
@vienhoang
vienhoang / gist:cf01fdc1224a3b7bbd99
Last active Aug 29, 2015
SCSS: My sass reset file
View gist:cf01fdc1224a3b7bbd99
/*Reset file*/
/* ===== Colors ===== */
/*Design, layout*/
$green: #18bc9c;
$green-darker: darken(#11866f, 2%);
$orange: #ffa800;
$orange-light: #ffb629;
$orange-medium: darken($orange, 5%);
$orange-dark: darken($orange, 10%);
View gist:d510780992aae49613a2
/*Reset file*/
/* ===== Colors ===== */
/*Design, layout*/
@green: #18bc9c;
@green-darker: darken(#11866f, 2%);
@orange: #ffa800;
@orange-light: #ffb629;
@orange-medium: darken(@orange, 5%);
@orange-dark: darken(@orange, 10%);
View gist:15c5e24bafbe216c4351
PHP Misc
================================================================================================
Difference between two dates
$date1 = new DateTime('2007-03-24');
$date2 = new DateTime('2009-06-26');
$interval = $date1->diff($date2);
echo 'difference: ' . $interval->y . ' years, ' . $interval->m.' months, '.$interval->d.' days ';
---
Trim ending slashes
View gist:03b90bd5f2fe174b7874
<?php
$images = array(
'logo.png',
'background.jpg',
'http://www.hardcoregamer.com/wp-content/uploads/2014/03/BAK_Sshot019.jpg'
);
foreach ($images as $image) {
$src = (substr($image,0,4) == 'http') ? $image : "images/$image";
View gist:134add875ccbfa1fceeb
Eclipse Commands
ctrl+shift+o | Organize packages import
alt+shift+j | Add a Javadoc comment
ctrl+alt+down | Duplicate selected line of code
alt+up | Move current line up
You can’t perform that action at this time.