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 / MONGO_DB.md
Last active August 13, 2025 16:23
Search users with fullname in MongoDB using Mongoosejs and Aggregation Framework in Node.js

MongoDB’s Aggregation Framework

It processes documents through a pipeline of stages, where each stage transforms the documents before passing them to the next

The aggregation framework is MongoDB’s built-in way to do multi-document analysis like this — counting, grouping, transforming and filtering in one pipeline.

Aggregation Framework in MongoDB works very much like an RxJS pipeline, but for database documents. Pipeline stages are like RxJS operators, Documents flow through the pipeline like events through a stream and Each stage outputs a new transformed stream of documents to the next stage. In MongoDB’s Aggregation Framework, the stream is inside the database engine, so it’s usually much faster because it avoids network round-trips and leverages DB indexes.

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