A Pen by Daniel Stancu on CodePen.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// http://johnford.is/programmatically-pull-attachments-from-wordpress-posts/ | |
// http://www.wprecipes.com/how-to-show-wordpress-post-attachments | |
// get all of the images attached to the current post | |
function _get_images($size = 'thumbnail') { | |
global $post; | |
$photos = get_children( array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
NewerOlder