Greet User: http://jsfiddle.net/endeepak/6FdSS/
Greet User if Name is Entered: http://jsfiddle.net/endeepak/BDuxr/2/
Greet User: http://jsfiddle.net/endeepak/6FdSS/
Greet User if Name is Entered: http://jsfiddle.net/endeepak/BDuxr/2/
| // Basics | |
| "foo" // string | |
| 'foo' // string | |
| var foo = {} // new object | |
| [1, 2, "foo", "bar"] // new array | |
| var foo = { | |
| name: 'Foo', | |
| Greet: function(otherName){ | |
| console.log("Hello I am " + this); | |
| console.log("Hello " + otherName + " my name is " + this.name); |
| angular.module('overlay', []) | |
| .factory('overlay', function () { | |
| var enabled = true; | |
| var show = function(){ | |
| if(enabled) | |
| $('#overlay').show(); | |
| } | |
| var hide = function(){ |
| //Creating promise which resolves after all promises are resolved | |
| var deferrable = $q.defer(); | |
| var promises = []; | |
| promises.push(fooPromise); | |
| promises.push(barPromise); | |
| $q.all(promises).then(function(){ | |
| deferrable.resolve(); | |
| }) | |
| return deferrable.promise; |
| // Credits: Adam's answer in http://stackoverflow.com/a/20786262/69362 | |
| // Paste this in browser's console | |
| var $rootScope = angular.element(document.querySelectorAll("[ui-view]")[0]).injector().get('$rootScope'); | |
| $rootScope.$on('$stateChangeStart',function(event, toState, toParams, fromState, fromParams){ | |
| console.log('$stateChangeStart to '+toState.to+'- fired when the transition begins. toState,toParams : \n',toState, toParams); | |
| }); | |
| $rootScope.$on('$stateChangeError',function(event, toState, toParams, fromState, fromParams){ | |
| console.log('$stateChangeError - fired when an error occurs during transition.'); |
| (function(){ | |
| var update = function() { | |
| $('.card-short-id').removeClass('hide').css('font-weight',700); | |
| $('.list-header-num-cards').removeClass('hide').css('font-weight',700); | |
| }; | |
| $(document).ready(function() { | |
| update(); | |
| setInterval(update, 5000); | |
| }); |
| #!/bin/sh | |
| unset DISPLAY | |
| if [ ! -f /tmp/.X99-lock ]; then | |
| Xvfb :99 -ac & | |
| fi | |
| export DISPLAY=:99 | |
| bundle install --path ../bundle --quiet --without development production && |
| # Delete all indices | |
| curl -XDELETE localhost:9200/* |
| CREATE DATABASE oracle; | |
| \c oracle; | |
| CREATE TABLE matrix("the 1" varchar); | |
| INSERT INTO matrix VALUES('Neo'); | |
| SELECT "the 1" FROM matrix; |
| // Ping Code Adopted From: https://bitbucket.org/teckel12/arduino-new-ping/wiki/Home#!single-pin-sketch | |
| #include <NewPing.h> | |
| #define PING_PIN 12 // Arduino pin tied to both trigger and echo pins on the ultrasonic sensor. | |
| #define PING_MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm. | |
| NewPing sonar(PING_PIN, PING_PIN, PING_MAX_DISTANCE); // NewPing setup of pin and maximum distance. | |
| void setup() { | |
| Serial.begin(9600); |