Skip to content

Instantly share code, notes, and snippets.

View IamAdamJowett's full-sized avatar

Adam Jowett IamAdamJowett

  • LifersAI
  • Brisbane, Australia
View GitHub Profile
@IamAdamJowett
IamAdamJowett / angular-2-cloud-9.md
Last active May 20, 2019 16:16
Running Angular 2 and Angular 4 on Cloud9

##Angular CLI (ng serve)

To run the standard angular-cli ng serve on a Cloud9 box, you need to specify the cloud9 specific ports the preview runs off as well as define a live preview port. So instead of the angular-cli command of ng serve, run the following:

ng serve --host 0.0.0.0 --port 8080 --live-reload-port 8081

The port configuration is the important part to make sure it is accessible to preview. Once running, preview the App as per usual in Cloud9 via the "Preview" button (no need to use the "Run" button).

To make things easier, you can assign that command to an alias:

@IamAdamJowett
IamAdamJowett / dropbox-debian-64.md
Last active September 19, 2015 00:14 — forked from facelordgists/dropbox-debian-64.md
Setup Dropbox on Debian 64bit
  1. Install Dropbox

  2. Add this line to ~/.profile

     export PATH=$HOME/bin:$PATH
    
  3. Create /etc/init.d/dropbox

  4. Add the contents of the file below

  5. Make the script executable and add it to the system startup

sudo chmod +x /etc/init.d/dropbox

@IamAdamJowett
IamAdamJowett / git-tricks.md
Last active September 13, 2015 22:58
Handy git tricks

####Alias for a formatted changelog###

git config --global alias.changes '!git log --oneline --decorate > changelog.txt'

To export a changelog text file to the current directory named changelog.txt run:

git changes

####Alias for a formatted changelog with branch trees###

@IamAdamJowett
IamAdamJowett / ionic-tips.md
Last active February 3, 2017 23:50
Useful Ionic 1 Framework tips and tricks

###Restore an Ionic App to state left by other developer

This will restore any platforms and cordova plugins listed in the package.json file under cordovePlugins and cordovaPlatforms. These are platforms and plugins added via ionic platform add and ionic plugin add rather than via npm (which live in platforms and plugins in the package.json file).

ionic state restore

###Change the network address for live preview

Sometimes you need to switch which network address live preview is going to listen to on ionic run --device -l or ionic serve --lab calls, this can be done by:

@IamAdamJowett
IamAdamJowett / javascript-tips.md
Last active August 29, 2015 14:10
JavaScript tips

Safe function calls

As described by David Walsh: http://davidwalsh.name/function-attempt

function attempt(fn, args, binding) {
	try {
		return fn.apply(binding, args);
	} catch(e) {
		console.log('Exception, fix me please', e);

}

@IamAdamJowett
IamAdamJowett / gist:944238e6c0826eed1a09
Created September 16, 2014 10:46
Dynamically add a directives in AngularJS
var table = angular.element(document.createElement('pc-table'));
var tableElement = $compile(table)($scope);
angular.element(elem.parent()).append(table);