(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
/* | |
* jQuery special events for delayedEnter, delayedLeave, and delayedHover | |
* Author: Scott Jehl, [email protected] | |
* Copyright (c) 2011 Filament Group | |
* licensed under MIT | |
* note: Each event can be used with bind or live event handling as you would use mouseenter,mouseleave, and hover | |
* events fire after 200ms timeout | |
*/ | |
(function($){ | |
//delayedEnter event |
// Assuming you have included the firebase script tag above this javascript | |
// For reference here is the tag: <script src="https://cdn.firebase.com/js/client/2.3.2/firebase.js"></script> | |
// Assumes you have already authenticated the user. | |
// Setup your firebase reference | |
var ref = new Firebase('https://your-app.firebaseIO-demo.com/'); | |
// Setup a way to get your userid (Assuming using provided firebase authentication method...) | |
function getUser(authData) { |
import {Pipe, PipeTransform} from 'angular2/core'; | |
/* | |
* Changes the case of the first letter of a given number of words in a string. | |
*/ | |
@Pipe({name: 'titleCase', pure: false}) | |
export class TitleCase implements PipeTransform { | |
transform(input:string, length: number): string{ | |
return input.length > 0 ? input.replace(/\w\S*/g, (txt => txt[0].toUpperCase() + txt.substr(1).toLowerCase() )) : ''; |
(function(){ | |
var SCROLL_WIDTH = 24; | |
var btn_popup = document.getElementById("btn_popup"); | |
var popup = document.getElementById("popup"); | |
var popup_bar = document.getElementById("popup_bar"); | |
var btn_close = document.getElementById("btn_close"); | |
var smoke = document.getElementById("smoke"); |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
body { | |
margin-left : 15px; | |
margin-top: 15px; | |
} | |
input { |
<form novalidate="novalidate" on-valid-submit="updateUser()"> | |
<div class="list list-inset"> | |
<div class="item"> | |
<h2>{{'edit profile'|i18n}}</h2> | |
</div> | |
<label class="item item-input validated"> | |
<span class="input-label">{{ 'full name' | i18n}}:</span> | |
<input type="text" ng-model="user.fullname" id="fullname" name="fullname" required="required" | |
ng-pattern="/^[^$%]{3,255}$/" | |
/> |
[ | |
{name: 'Afghanistan', code: 'AF'}, | |
{name: 'Åland Islands', code: 'AX'}, | |
{name: 'Albania', code: 'AL'}, | |
{name: 'Algeria', code: 'DZ'}, | |
{name: 'American Samoa', code: 'AS'}, | |
{name: 'AndorrA', code: 'AD'}, | |
{name: 'Angola', code: 'AO'}, | |
{name: 'Anguilla', code: 'AI'}, | |
{name: 'Antarctica', code: 'AQ'}, |
function go() { | |
var userId = prompt('Username?', 'Guest'); | |
checkIfUserExists(userId); | |
} | |
var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users'; | |
function userExistsCallback(userId, exists) { | |
if (exists) { | |
alert('user ' + userId + ' exists!'); |
/*************************************************** | |
* Assuming you can't use priorities (e.g. they are already being used for something else) | |
* You can store the email addresses in an index and use that to match them to user ids | |
***************************************************/ | |
var fb = new Firebase(URL); | |
/** | |
* Looks up a user id by email address and invokes callback with the id or null if not found | |
* @return {Object|null} the object contains the key/value hash for one user |