Skip to content

Instantly share code, notes, and snippets.

View Yogatopia's full-sized avatar
👨‍💻
Coding

Armand Lacle Yogatopia

👨‍💻
Coding
View GitHub Profile
import { Directive } from '@angular/core';
import { ViewController } from 'ionic-angular';
@Directive({
selector: '[hideTabs]'
})
export class HideTabsDirective {
constructor(private viewCtrl: ViewController) {
// hide tabs when view loads
@Yogatopia
Yogatopia / app.js
Created April 20, 2017 11:42
AppServer code for Push Notification
var firebase = require('firebase-admin');
var request = require('request');
// Fetch the service account key JSON file contents
var serviceAccount = require("path/to/serviceAccountKey.json");
var env = require("path/to/env.json");
// Your Firebase Cloud Messaging Server API key
var API_KEY = env.CLOUD_MESSAGE_API_KEY;
@Yogatopia
Yogatopia / index.js
Created April 20, 2017 11:38
Cloud Function for Push Notification
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
/**
* Triggers when new subject added in the list and sends a notification.
*/
exports.sendNotification = functions.database.ref('/subjects/{subjectKey}').onWrite((event) => {
@Yogatopia
Yogatopia / 0firebase_functions_cheatsheet.js
Created April 20, 2017 08:23
firebase_functions_cheatsheet.js
// Core
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
const db = admin.database();
admin.auth().createUser({
uid: uid,
displayName: displayName,
photoURL: photoURL
@Yogatopia
Yogatopia / Index.html
Last active October 5, 2015 15:07
Instafeed.js
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
<title>Instagram.js</title>
<link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="node_modules/instafeed.js/instafeed.min.js"></script>
<style>
@Yogatopia
Yogatopia / Intervals.py
Created July 4, 2015 13:17
Python Snippets
import threading
def do_every (interval, worker_func, iterations = 0):
if iterations != 1:
threading.Timer (
interval,
do_every, [interval, worker_func, 0 if iterations == 0 else iterations-1]
).start ()
worker_func ()
@Yogatopia
Yogatopia / onbeforeunload-1.js
Created June 1, 2015 09:43
Confirmation on Leaving the Current Page in JavaScript
function goodbye(e) {
if(!e) e = window.event;
//e.cancelBubble is supported by IE - this will kill the bubbling process.
e.cancelBubble = true;
e.returnValue = 'You sure you want to leave?'; //This is displayed on the dialog
//e.stopPropagation works in Firefox.
if (e.stopPropagation) {
e.stopPropagation();
e.preventDefault();
@Yogatopia
Yogatopia / 2_keyboard_shortcuts.md
Last active August 29, 2015 14:20
Here are some things you can do with Gists in GistBox.

Create documentation for your projects. Like so:


Most popular keyboard shortcuts within GistBox

  • Up/Down - Previous/Next Gist
  • Ctrl+e - Edit a selected Gist
  • Ctrl+s - Save Gist
@Yogatopia
Yogatopia / index.html
Created April 28, 2015 12:15
Fundation 5 Basic CDN Setup
<!DOCTYPE html>
<!--[if IE 9]><html class="lt-ie10" lang="en" > <![endif]-->
<html class="no-js" lang="en" >
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Foundation 5</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.1/css/normalize.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.1/css/foundation.min.css">