Skip to content

Instantly share code, notes, and snippets.

View dashawk's full-sized avatar

Jason Panugaling dashawk

  • Cebu City, Philippines
View GitHub Profile
@dashawk
dashawk / center-column.css
Created October 10, 2016 02:37
Twitter Bootstrap Center any column
.center-column {
float: none !important;
margin: 0 auto;
}
.no-padding-left {
padding-left: 0;
}
.no-padding {
padding: 0;
}
@dashawk
dashawk / download_egghead_videos.md
Created December 12, 2016 04:31 — forked from ldong/download_egghead_videos.md
download egghead videos

Download videos from egghead

Go to the egghead website, i.e. Building a React.js App

run

$.each($('h4 a'), function(index, video){
  console.log(video.href);
});
@dashawk
dashawk / core.route.js
Last active January 30, 2017 03:50
[FIX] generator-hottowel-html5mode(false)
routerHelper.configureStates(getStates(levels), function () {
var redirects = '/404';
if($state.current.url === '^') {
redirects = '/'; // Or Whatever your homepage is
}
return redirects;
});
@dashawk
dashawk / gist:464ba6b7c214f9d7bbcefa7aad08afaa
Created March 16, 2017 02:07 — forked from Mithrandir0x/gist:3639232
Difference between Service, Factory and Provider in AngularJS
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
@dashawk
dashawk / youtube-dl-download-pluralsight.md
Created April 25, 2017 14:29 — forked from munim/youtube-dl-download-pluralsight.md
youtube-dl to download pluralsight videos

Download Plural Sight videos

Software required:

youtube-dl

After installation and putting the youtube-dl in PATH

youtube-dl \
/* CORS */
const Hapi = require('hapi');
const server = new Hapi();
server.connection({
host: '0.0.0.0',
port: this.config.webservice_port,
routes: {
cors: {
@dashawk
dashawk / walksync.js
Created June 23, 2017 16:47 — forked from kethinov/walksync.js
List all files in a directory in Node.js recursively in a synchronous fashion
// List all files in a directory in Node.js recursively in a synchronous fashion
var walkSync = function(dir, filelist) {
var fs = fs || require('fs'),
files = fs.readdirSync(dir);
filelist = filelist || [];
files.forEach(function(file) {
if (fs.statSync(dir + file).isDirectory()) {
filelist = walkSync(dir + file + '/', filelist);
}
else {
@dashawk
dashawk / .bashrc
Created June 29, 2017 02:12
My Windows .bashrc
#!/bin/bash
# Make .bashrc available to non interactive shells (.sh scripts)
export BASH_ENV=~/.bashrc
env=~/.ssh/agent.env
loadEnv () {
test -f "$env" && . "$env" >| /dev/null ;
}
@dashawk
dashawk / node-deploy-as-upstart-service.md
Created July 3, 2017 11:53 — forked from learncodeacademy/node-deploy-as-upstart-service.md
Deploy Node.js app on Ubuntu as Upstart Service - instead of using Forever

Deploying a node app with Forever is great...until your server restarts unexpectedly. Then your app stops running and you have to re-deploy.

To get around this, we're going to run our node app as an Upstart service. Upstart services are great, because, once started, the system auto-restarts them if they fail, or if the server restarts.

###Step 1: Create a service for your node app

  • ssh in as root ssh root@youripaddress
  • Create a node-app.conf file in /etc/init
    IMPORTANT: whatever filename you pick is what you will use to start|stop|restart your service i.e. service node-app start
@dashawk
dashawk / dates.js
Last active July 26, 2017 07:01
Manipulate Dates in Javascript
/**
* Returns the hour difference between two dates
*/
function getHours(startDate, endDate) {
return Math.floor(Math.abs(startDate - endDate) / 3.6e6);
}
/**
* Returns the current hour in 12-hours format
*/