Skip to content

Instantly share code, notes, and snippets.

View jdnichollsc's full-sized avatar
🏠
Working from home

J.D Nicholls jdnichollsc

🏠
Working from home
View GitHub Profile
@jdnichollsc
jdnichollsc / app.js
Last active November 16, 2017 13:12
Service with Angular.js in Ionic Framework to get Products from Web Service or Local Storage using Promises and ngCordova
var app = angular.module('demo', ['ionic', 'ngCordova', 'demo.controllers', 'demo.services']);
var controllers = angular.module('demo.controllers', []);
var services = angular.module('demo.services', []);
@jdnichollsc
jdnichollsc / docsController.js
Last active January 26, 2016 10:39
PouchDB with SQLite plugin in Ionic Framework (Pre-populated database) => Using service pattern
controllers.controller('DocsController', ['$scope', '$ionicPlatform', 'Docs', 'Products' function ($scope, $ionicPlatform, Docs, Products) {
$scope.products = [];
$scope.allDocs = [];
$ionicPlatform.ready(function () {
//Insert a new product
Products.addProduct({
name : 'Milk',
@jdnichollsc
jdnichollsc / demoModal.html
Created June 21, 2015 06:10
Change size of modal dialog in Ionic Framework
<ion-modal-view class="mymodal">
...
</ion-modal-view>
@jdnichollsc
jdnichollsc / Codes
Last active June 22, 2023 19:04
Ionic Framework Links
- Ejemplo de Gulp con Ionic => https://gist.github.com/jdnichollsc/e3a323223fcb7822dbba
- SQLite con ngCordova usando patrón de servicio y promesas => https://gist.github.com/jdnichollsc/9ac79aaa3407e92677ba
- Permitir dinamicamente arrastrar elementos de una Lista => https://gist.github.com/mhartington/c5107ccd9204b755442b
- Obtener datos consumiendo un servicio REST o desde el LocalStorage => https://gist.github.com/jdnichollsc/7367fe5b17369e856157
- Cambiar el tamaño de un Modal => https://gist.github.com/jdnichollsc/1b0112dfdca4b7f06fbe
- OAuth Authentication, Firebase 3 and ngCordovaOauth => https://gist.github.com/jdnichollsc/17bae6581d405321937fe433410172c9
- Firebase Upload Files => https://gist.github.com/jdnichollsc/5ddc40c1c482e6209a8f4d634fd11d1e
- Download and Open Files => https://gist.github.com/jdnichollsc/1e
@jdnichollsc
jdnichollsc / app.js
Last active April 14, 2019 03:23
SQLite plugin with ngCordova in Ionic Framework => Using service pattern (Works for litehelpers/Cordova-sqlite-storage and MSOpenTech/cordova-plugin-websql) Code => http://1drv.ms/1Ono0Ys Template => https://github.com/jdnichollsc/Ionic-Starter-Template
angular.module('Demo', ['ionic', 'Demo.controllers', 'Demo.services', 'ngCordova'])
.run(function ($ionicPlatform, sqliteService) {
$ionicPlatform.ready(function () {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
@jdnichollsc
jdnichollsc / Basic Structure
Last active February 17, 2018 03:06
Gulp Example with Ionic Framework
css/
----- ionic.app.css //Created using Gulp - Used for debugging
----- ionic.app.min.css //Created using Gulp
----- style.css
----- //More styles from libraries like tooltipster.css for example
img/
----- logo.png
----- icons/ //Example
---------- user1.png
---------- user2.png
@jdnichollsc
jdnichollsc / boot.js
Last active January 7, 2024 02:34
Phaser Landscape Orientation
var bootState = {
preload: function () {
this.game.load.image('loading', 'assets/loading.png'); //Load images to show progress bar in the next state
this.game.load.image('loadingborder', 'assets/loadingborder.png');
this.game.stage.backgroundColor = '#A5DEF1'; //Change background color if you want
},
create: function () {
//Configure plugins like better transitions
this.game.stateTransition = this.game.plugins.add(Phaser.Plugin.StateTransition);
this.game.stateTransition.configure({
@jdnichollsc
jdnichollsc / models-user.js
Last active March 19, 2021 08:10
Search users with fullname in MongoDB using Mongoosejs and Aggregation Framework in Node.js
var mongoose = require('mongoose');
var validate = require('mongoose-validator');
var Schema = mongoose.Schema;
var crypto = require('crypto');
var utilities = require('../services/utilities');
var userSchema = new Schema({
firstname: { type : String, trim : true },
lastname: { type : String, trim : true },
username: { type: String, required: true, unique: true, lowercase: true, trim : true, index : true },
sudo su
//Check Firewall
ufw status
ufw allow 8080
ufw reload
//Execute node app.js
pm2 start app.js --name "MyNodeApp" -i 0
//Execute npm start
@jdnichollsc
jdnichollsc / Output
Created November 2, 2015 17:38
No valid MSBuild was detected for the selected target.
1>------ Build started: Project: Blank, Configuration: Release Windows-x64 ------
1> Your environment has been set up for using Node.js 0.12.7 (x64) and npm.
1> ------ Ensuring correct global installation of package from source package directory: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\EXTENSIONS\APACHECORDOVATOOLS\packages\vs-tac
1> ------ Name from source package.json: vs-tac
1> ------ Version from source package.json: 1.0.13
1> ------ Package already installed globally at correct version.
1> ------ Cordova tools 5.3.1 already installed.
1> ------ Build Settings:
1> ------ Build Settings:
1> ------ platformConfigurationBldDir: C:\Apps\Windows\Blank\Blank\bld\Windows-x64\Release