Skip to content

Instantly share code, notes, and snippets.

@aggarwalankush
aggarwalankush / Sql.ts
Last active December 19, 2019 12:33
Ionic 2 storage
import {Injectable} from "@angular/core";
import {Platform} from "ionic-angular";
const DB_NAME: string = '__mydbname';
const win: any = window;
@Injectable()
export class Sql {
private _dbPromise: Promise<any>;
import {Sql} from "../providers/Sql";
export class ExamplePage {
constructor(private sql: Sql) {
//sql.query(...);
//...
}
}
@suissa
suissa / remodelagem-para-mongodb.md
Last active June 21, 2020 19:58
Um aluno do Be MEAN postou essa modelagem relacional a qual ele estava com dificuldades para passar para o MongoDB, então vou ensinar aqui como faz

Remodelagem do Relacional para o MongoDb

Um aluno do Be MEAN postou essa modelagem relacional a qual ele estava com dificuldades para passar para o MongoDB, então vou ensinar aqui como faz

Vamos inicialmente separar pelas COLEÇÕES que achamos que devemos ter:

  • Usuario;
  • Escola;
@debashisbarman
debashisbarman / README.md
Last active February 15, 2024 02:19
A boilerplate Twitter bot that can retweet in response to the tweets matching particluar keyword (https://goo.gl/4whEIt)

Creating a Twitter bot with Node.js

Learn how you can create your own Twitter bot using Node.js and the new Twitter API. The bot will auto retweet in response to tweets with some particular hashtags. (https://goo.gl/4whEIt)

Tools we need

Here are the tools we’ll be using to create the bot — 

  • Node.js installed in your machine
  • A registered Twitter account

Create a Twitter application

@hmbilal
hmbilal / README.md
Last active June 18, 2019 15:05
Long polling service in AngularJS

Then in your controller, inject $polling and start polling like this.

General use

$polling.startPolling({name_of_this_polling}, {url_to_fetch_data_from}, {time_in_milli_seconds}, {callback});

Example,

$polling.startPolling('fetchNotifications', 'http://localserver.local/fetch/notifications', 10000, $scope.processData);

@chad3814
chad3814 / gist:2924672
Last active January 16, 2024 20:27
deleting array items in javascript with forEach() and splice()
// This is from my comment here: http://wolfram.kriesing.de/blog/index.php/2008/javascript-remove-element-from-array/comment-page-2#comment-466561
/*
* How to delete items from an Array in JavaScript, an exhaustive guide
*/
// DON'T use the delete operator, it leaves a hole in the array:
var arr = [4, 5, 6];
delete arr[1]; // arr now: [4, undefined, 6]