Skip to content

Instantly share code, notes, and snippets.

@guibot17
guibot17 / delayedEnter, delayedLeave, and delayedHover.js
Created September 12, 2017 05:27 — forked from ixisio/delayedEnter, delayedLeave, and delayedHover.js
Simple delayed events for `mouseenter` & `mouseleave`
/*
* jQuery special events for delayedEnter, delayedLeave, and delayedHover
* Author: Scott Jehl, scott@filamentgroup.com
* 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
@guibot17
guibot17 / firebase_firstime_user.js
Created July 19, 2017 19:20 — forked from shadowcodex/firebase_firstime_user.js
Firebase: Detecting if user exists.This snippet detects if a user ID already exists, in order to do first time user functions.
// 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) {
@guibot17
guibot17 / titlecase.pipe.ts
Created July 11, 2017 01:17 — forked from apkostka/titlecase.pipe.ts
Angular 2 pipe to transform string to Title Case
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() )) : '';
@guibot17
guibot17 / app.js
Created May 10, 2017 07:49 — forked from akirattii/app.js
Draggable & Movable popup example using pure javascript.
(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");
@guibot17
guibot17 / introrx.md
Created October 16, 2016 09:39 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@guibot17
guibot17 / angular-searchBoxDirective.html
Created March 8, 2016 02:59 — forked from ThomasBurleson/angular-searchBoxDirective.html
Sample of using AngularJS MySearchboxDirective. This demonstrates some fixes for the example demonstrated in the slides http://slides.com/djsmith/deep-dive-into-custom-directives
<!DOCTYPE html>
<html>
<head>
<style>
body {
margin-left : 15px;
margin-top: 15px;
}
input {
@guibot17
guibot17 / example.html
Created March 1, 2016 01:56 — forked from malixsys/example.html
ionic errors
<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}$/"
/>
@guibot17
guibot17 / countries.json
Created December 15, 2015 08:53 — forked from keeguon/countries.json
A list of countries in JSON
[
{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'},
@guibot17
guibot17 / firebase_detect_data.js
Last active September 15, 2015 19:22 — forked from anantn/firebase_detect_data.js
Firebase: Detecting if data exists. This snippet detects if a user ID is already taken
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!');
@guibot17
guibot17 / using_an_index.js
Last active September 15, 2015 19:21 — forked from katowulf/1_using_queries.js
Methods to search for user accounts by email address in Firebase
/***************************************************
* 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