Wednesday, December 27, 2017

css transition

.our_content {
 /* Initially we don't want any height, and we want the contents to be hidden */
 max-height: 0;
 overflow: hidden;

 /* Set our transitions up. */
 -webkit-transition: max-height 0.8s;
 -moz-transition: max-height 0.8s;
 transition: max-height 0.8s;
}
.outside_box:hover .our_content {
 /* On hover, set the max-height to something large. In this case there's an obvious limit. */
 max-height: 200px;
}

Wednesday, July 26, 2017

see the mongo db

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\Users\david>cd ../..

C:\>cd "Program Files"

C:\Program Files>ls
'ls' is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files>dir
 Volume in drive C has no label.
 Volume Serial Number is CC44-F6B4

 Directory of C:\Program Files

21/07/2017  14:58    <DIR>          .
21/07/2017  14:58    <DIR>          ..
26/01/2017  23:33    <DIR>          Adobe
30/11/2016  00:41    <DIR>          Blender Foundation
27/05/2017  12:08    <DIR>          Bonjour
21/07/2017  14:58    <DIR>          Charles
27/05/2017  12:07    <DIR>          Common Files
28/01/2017  14:35    <DIR>          DIFX
09/03/2017  01:22    <DIR>          dotnet
23/06/2017  17:09    <DIR>          FileZilla FTP Client
18/09/2016  09:58    <DIR>          Git
28/04/2017  15:38    <DIR>          HP
05/12/2016  15:23    <DIR>          IIS
09/03/2017  01:21    <DIR>          IIS Express
15/03/2017  03:17    <DIR>          Internet Explorer
27/05/2017  12:08    <DIR>          iPod
27/05/2017  12:09    <DIR>          iTunes
05/06/2017  23:33    <DIR>          Java
22/06/2017  12:02    <DIR>          JetBrains
09/03/2017  01:03    <DIR>          Microsoft
09/03/2017  01:59    <DIR>          Microsoft Analysis Services
20/09/2016  12:38    <DIR>          Microsoft DNX
30/11/2016  21:26    <DIR>          Microsoft Office
09/03/2017  01:42    <DIR>          Microsoft SDKs
16/06/2017  02:12    <DIR>          Microsoft Silverlight
20/09/2016  14:15    <DIR>          Microsoft SQL Server
20/09/2016  13:14    <DIR>          Microsoft SQL Server Compact Edition
20/09/2016  11:31    <DIR>          Microsoft Visual Studio 12.0
26/07/2017  10:15    <DIR>          MongoDB
27/01/2017  21:51    <DIR>          MSBuild
22/06/2017  17:23    <DIR>          nodejs
27/01/2017  21:51    <DIR>          Reference Assemblies
13/03/2017  02:19    <DIR>          Sublime Text 3
17/01/2017  17:21    <DIR>          Synaptics
29/06/2017  20:44    <DIR>          UNP
09/03/2017  01:43    <DIR>          VS2010Schemas
09/03/2017  01:43    <DIR>          VS2012Schemas
10/05/2017  18:44    <DIR>          Windows Defender
05/12/2016  22:59    <DIR>          Windows Defender Advanced Threat Protection
14/07/2017  00:13    <DIR>          Windows Mail
16/07/2016  12:45    <DIR>          Windows NT
14/07/2017  00:13    <DIR>          Windows Photo Viewer
16/07/2016  12:45    <DIR>          WindowsPowerShell
22/09/2016  09:03    <DIR>          WinHTTrack
               0 File(s)              0 bytes
              44 Dir(s)  59,793,289,216 bytes free

C:\Program Files>cd MongoDB

C:\Program Files\MongoDB>dir
 Volume in drive C has no label.
 Volume Serial Number is CC44-F6B4

 Directory of C:\Program Files\MongoDB

26/07/2017  10:15    <DIR>          .
26/07/2017  10:15    <DIR>          ..
10/07/2017  10:21    <DIR>          Server
               0 File(s)              0 bytes
               3 Dir(s)  59,793,289,216 bytes free

C:\Program Files\MongoDB>cd Server/

C:\Program Files\MongoDB\Server>dir
 Volume in drive C has no label.
 Volume Serial Number is CC44-F6B4

 Directory of C:\Program Files\MongoDB\Server

10/07/2017  10:21    <DIR>          .
10/07/2017  10:21    <DIR>          ..
10/07/2017  10:21    <DIR>          3.4
               0 File(s)              0 bytes
               3 Dir(s)  59,793,289,216 bytes free

C:\Program Files\MongoDB\Server>cd 3.4

C:\Program Files\MongoDB\Server\3.4>dir
 Volume in drive C has no label.
 Volume Serial Number is CC44-F6B4

 Directory of C:\Program Files\MongoDB\Server\3.4

10/07/2017  10:21    <DIR>          .
10/07/2017  10:21    <DIR>          ..
10/07/2017  10:21    <DIR>          bin
05/07/2017  18:25            35,181 GNU-AGPL-3.0
05/07/2017  18:25            17,099 MPL-2
05/07/2017  18:25             1,359 README
05/07/2017  18:25            56,801 THIRD-PARTY-NOTICES
               4 File(s)        110,440 bytes
               3 Dir(s)  59,793,285,120 bytes free

C:\Program Files\MongoDB\Server\3.4>cd bin

C:\Program Files\MongoDB\Server\3.4\bin>dir
 Volume in drive C has no label.
 Volume Serial Number is CC44-F6B4

 Directory of C:\Program Files\MongoDB\Server\3.4\bin

10/07/2017  10:21    <DIR>          .
10/07/2017  10:21    <DIR>          ..
05/07/2017  18:25         4,912,640 bsondump.exe
05/07/2017  18:35        11,693,568 mongo.exe
05/07/2017  18:39        27,544,064 mongod.exe
05/07/2017  18:39       259,403,776 mongod.pdb
05/07/2017  18:25         8,486,912 mongodump.exe
05/07/2017  18:25         6,454,784 mongoexport.exe
05/07/2017  18:25         6,308,864 mongofiles.exe
05/07/2017  18:25         6,623,232 mongoimport.exe
05/07/2017  18:25         6,064,640 mongooplog.exe
05/07/2017  18:40        23,822,336 mongoperf.exe
05/07/2017  18:25         9,924,096 mongorestore.exe
05/07/2017  18:39        14,356,480 mongos.exe
05/07/2017  18:39       130,617,344 mongos.pdb
05/07/2017  18:25         6,602,752 mongostat.exe
05/07/2017  18:25         6,274,560 mongotop.exe
              15 File(s)    529,090,048 bytes
               2 Dir(s)  59,793,285,120 bytes free

C:\Program Files\MongoDB\Server\3.4\bin>mongo.exe
MongoDB shell version v3.4.6
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.6
Server has startup warnings:
2017-07-26T10:20:14.860+0100 I CONTROL  [initandlisten]
2017-07-26T10:20:14.860+0100 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2017-07-26T10:20:14.860+0100 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2017-07-26T10:20:14.860+0100 I CONTROL  [initandlisten]
> show databases;
admin             0.000GB
craft-shop        0.000GB
local             0.000GB
my-site           0.000GB
profile-pension   0.002GB
profile-pensions  0.001GB
sydjs-site        0.001GB
> use profile-pension
switched to db profile-pension
> show collections
app_updates
enquiries
galleries
homepages
meettheteammembers
meettheteams
pages
pensions
portfolios
postcategories
posts
products
teammembercategories
teammembers
tseammembers
users
> db.posts.find()

Friday, June 23, 2017

of course, there are cases where the complexity of Universal App may be justified. In particular 1 if your app's content need's to be indexed by Google, it is valuable to be able to control the HTML that Google sees. Rendering server side allows you to do this. - Instagram chief says that they're still find it usefully for SEO 2 if you're at the point when every millisecond of page loads causes a measurable decrease in revenue, server-side rendering can make things appear on your's screens faster. 3 if you have important users whose device is too underpowered to support Javascript, Universal may be your only option In short , universal apps make sense when they solve a real problem. tHEY ARE NOT THE GOAL IN ANDS OF THEMSELVES

Thursday, February 23, 2017

zoom on hoover

.grow { transition: all .2s ease-in-out; } .grow:hover { transform: scale(1.1); }

Friday, February 10, 2017

Interacting with overlay elements on mobile HTML5 video



When we think of video on the Internet, we think more and more of HTML5 video and less of Flash players. This has made supporting video playback on mobile devices somewhat seamless, as the HTML5 standard is supported on most web-facing platforms.
The video playback itself has been standardised, as most platforms support the element's parameters and some similar formats (some still have problems with the major containers like MP4 etc.), but the way in which the video element itself is handled whilst in the context of a web page differs greatly between platforms. One of the major problems is playback initiation on some mobile platforms, namely iOS and Windows Phone (8) - For instance, iPhones will prevent touch events ("clicks") from registering to any and all elements over the video's bounding box (frame). Any hope of having interactive elements placed on top (or somehow overlaying) of a HTML5 video on these mobile devices is dashed when reading Apple's documentation:
On iOS-based devices with small screens—such as iPhone and iPod touch—video always plays in fullscreen mode, so the canvas cannot be superimposed on playing video. On iOS-based devices with larger screens, such as iPad, you can superimpose canvas graphics on playing video, just as you can on the desktop.
This is just one example (taken from here) where Apple states that you cannot place items over video elements on iPhone and iPod.
We can demonstrate this issue with a quick test - Let's assume we have a webpage (video.html) and a video file (chipmunk.mp4). The following HTML provides an example of the issues associated with overlaid elements on HTML5 video on iPhones etc.:
<html>
    <head>
        <title>HTML5 Video Test</title>
    </head>
    <body>
        <div id="mediaContainer" style="position: relative">
            <div id="videoContainer">
                <video src="chipmunk.mp4" controls="controls" />
            </div>
            <div id="overlayElement" style="width: 75px; height: 75px; background-color: green; position: absolute; top: 10px; left: 10px">
                &amp;nbsp;
            </div>
        </div>
        <script type="text/javascript">
            (function() {
                var overlayElement = document.getElementById("overlayElement");
                overlayElement.onclick = function(e) {
                    var el = e.target;
                    el.style.backgroundColor = "blue";
                    window.setTimeout(function() {
                        el.style.backgroundColor = "green";
                    }, 750);
                };
            })();
        </script>
    </body>
</html>
You can obviously use any MP4 in-place of the chipmunk video used in this code. If you place this on a webserver and browse to it on an iPhone, you will see that you cannot interact with the green box (div) sitting over the video. If you viewed this page on a desktop computer, however, and clicked the green box, it will turn blue for a moment then go green again.
Let's imagine that the green box is actually a button designed to open something else, like an ad or a form - This button becomes useless on mobile devices, but still appears over the video item. This effect is undesirable in terms of user interactivity, and the issue appears on Windows Phones as well, carving out a good portion of the market that would not be able to use this custom "control".

A Solution for Overlaid Elements on Video

Unfortunately, there is absolutely no way around the issue of not being able to catch touch events on overlaid elements when a video element is concerned. We can, however, give the illusion of having overlaid elements (which is almost as good). To do this, in theory, we need to hide the video so that it cannot soak up any touch events. We then need to leave something in the void that looks like the video, like a poster - The poster will allow us to place items on it, overlaid, that will be interact-able.
There is, unfortunately, another caveat when attempting to use this solution. As mentioned earlier, the video element (at least on iOS devices) soaks up all touch events over it, no matter what layer it's on (z-index) and what's in front of it. This means we cannot simply push it somewhere inside of a div, with overflow set to hidden, and hope that it'll just work. Wherever that video sits will be "dead space". This is where the thought of hiding it comes into play - But wait! This'll fail as well if you intend on using your overlaid elements to play the video (perhaps acting as a play button). During the testing of some of my work-arounds, I noticed that the videos refuse to play after coming out of hiding (CSS styles from "display:none" to "visibility:hidden") - I believe this issue directly relates to Apple's standing on autonomous data usage:
In Safari on iOS (for all devices, including iPad), where the user may be on a cellular network and be charged per data unit, preload and autoplay are disabled. No data is loaded until the user initiates it. This means the JavaScript play() and load() methods are also inactive until the user initiates playback, unless the play() or load() method is triggered by user action. In other words, a user-initiated Play button works, but an onLoad="play()" event does not.
This standpoint of Apple's (found here) seems to take affect also when the visual styles of the video element change, namely from being hidden to visible. Because of this, when the video reappears (after closing the poster) we are not able to start it's playback, which kind of ruins the user experience. So there's yet another way around this: Don't hide the video, but move it off-screen.
If we set the container of the video's overflow to hidden, and then move the video element's top to say -2000px (or whatever is an appropriate distance for the length of the webpage etc. - We could even move it to the left as well, but this is just for demonstration purposes), we'll have a working poster switching element that'll work on iPhones and Windows Phones. Of course this setup isn't necessary for PCs and some tablets, so you may want to filter what devices actually end up using this method.
So here we go, let's use the following as your main structure:
    <div id="mediaContainer" style="position: relative; width: 600px; height: 400px; overflow: hidden">
        <div id="videoContainer" style="position: relative; width: 100%; height: 100%">
            <video id="video" src="chipmunk.mp4" controls="controls" style="width: 100%; height: 100%" />
        </div>
        <div id="overlay" style="position: relative; width: 100%; height: 100%; visibility: hidden; background-color: black">
            <img src="chipmunk.jpg" style="width: 100%; height: 100%" />
            <div id="overlayElement" style="width: 75px; height: 75px; background-color: green; position: absolute; top: 10px; left: 10px">
                Play
            </div>
        </div>            
    </div>
Please pardon my extreme use of inline styles and IDs, and bear with me. We have a media container (mediaContainer), which is the parent container for all of the action. The important features of this container is that is has an actual size (600x400) and that its overflow is hidden. It has 2 children: videoContainer and overlay, which should be self-explanatory. The videoContainer holds the video element, and the overlay contains a poster image (img) and an element called "overlayElement" (the 'play' button).
With this knowledge, witness the JavaScript:
var overlayShown = false;

function showOverlay() {
    // Hide video, show poster
    var overlay = document.getElementById("overlay");
    overlay.style.visibility = "visible";
    var videoContainer = document.getElementById("videoContainer");
    videoContainer.style.position = "absolute";
    videoContainer.style.top = "-2000px";
    overlayShown = true;
}

function hideOverlay() {
    // Hide poster, show video
    var overlay = document.getElementById("overlay");
    overlay.style.visibility = "hidden";
    var videoContainer = document.getElementById("videoContainer");
    videoContainer.style.position = "relative";
    videoContainer.style.top = "0px";
    overlayShown = false;
}

// init
(function() {
    var overlayElement = document.getElementById("overlayElement");
    overlayElement.onclick = function(e) {
        var el = e.target;
        el.style.backgroundColor = "blue";
        window.setTimeout(function() {
            // "Play" button clicked
            el.style.backgroundColor = "green";
            if (overlayShown) {
                hideOverlay();
                var videoElement = document.getElementById("video");
                videoElement.play();
            } else {
                showOverlay();
            }
        }, 750);
    };

    var videoElement = document.getElementById("video");
    videoElement.addEventListener('pause', function() {
        // Paused, show poster
        showOverlay();
    });
    videoElement.addEventListener('ended', function() {
        // Ended, try to close fullscreen if possible
        if (typeof videoElement.webkitExitFullscreen !== "undefined") {
            videoElement.webkitExitFullscreen();
        }
    });

    showOverlay();
})();
Again, please excuse my use of globals and other potentially poor practices, as this is merely a demonstration. OK, so we have 2 functions for hiding and showing the poster (and showing and hiding the video, respectively). On initialisation we add a click event to the 'play' button, which toggles the overlay. We also add "pause" and "ended" listeners to the video, which show the overlay and hide the Quicktime player on iOS (respectively).
When we click our fake play button on the overlay, the poster disappears and shows the video, which then starts playing. When the video pauses or ends, our event listeners fire and restore the overlay (hiding the video again). If we ensure that the thumbnail ("chipmunk.jpg" here) uses an image from the video ("chipmunk.mp4"), then we end up with a believable poster image for our video player. Go ahead and test it on an iPhone - Now the overlay elements are usable!

A Solution for Overlaid Elements on YouTube

Those of you wanting to use YouTube instead of a custom video player (or alongside one) will realise that this problem exists for YouTube players also. For YouTube, their own custom overlay appears first, and is also hidden when the video starts to play. The problem with this is that the overlay does not return when the video is paused or has ended. The element left on the page is a straight video element, which means it's either hidden your overlay elements or has rendered them useless.
The trick with YouTube is to allow them to show their overlay first, and then show ours every time the video is paused (or stopped) after that. There are obviously many differences between the HTML5 video element and the YouTube player, and these differences should be taken into account when dealing with them both. One such difference is the presence of an iframe to show the YouTube player, which makes it impractical to exit fullscreen mode like we did with the regular video player.
Below is the entirety of the code I used to test YouTube overlay functionality:
<!DOCTYPE html>
<html>
    <head>
        <title>HTML5 Video Test</title>
    </head>
    <body>
        <script type="text/javascript">
            var yt = null;

            function onYouTubeIframeAPIReady() {
                yt = new YT.Player('videoContainer', {
                    height: '315',
                    width: '420',
                    videoId: 'sVxUUotm1P4',
                    events: {
                        'onStateChange' : onPlayerStateChange
                    }
                });
            }

            (function() {
                var tag = document.createElement('script');
                tag.src = "https://www.youtube.com/iframe_api";
                var firstScriptTag = document.getElementsByTagName('script')[0];
                firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
            })();
        </script>
        <div id="mediaContainer" style="position: relative; width: 420px; height: 315px; overflow: hidden">
            <div id="videoContainer" style="position: relative; width: 100%; height: 100%">
                <!-- Youtube Player -->
            </div>
            <div id="overlay" style="position: relative; width: 100%; height: 100%; visibility: hidden; background-color: black">
                <img src="aladdin.jpg" style="width: 100%; height: 100%" />
                <div id="overlayElement" style="width: 75px; height: 75px; background-color: green; position: absolute; top: 10px; left: 10px">
                    Play
                </div>
            </div>            
        </div>
        <script type="text/javascript">
            var overlayShown = false;

            function showOverlay() {
                // Hide video, show poster
                var overlay = document.getElementById("overlay");
                overlay.style.visibility = "visible";
                var videoContainer = document.getElementById("videoContainer");
                videoContainer.style.position = "absolute";
                videoContainer.style.top = "-2000px";
                overlayShown = true;
            }

            function hideOverlay() {
                // Hide poster, show video
                var overlay = document.getElementById("overlay");
                overlay.style.visibility = "hidden";
                var videoContainer = document.getElementById("videoContainer");
                videoContainer.style.position = "relative";
                videoContainer.style.top = "0px";
                overlayShown = false;
            }

            function onPlayerStateChange(event) {
                if ((event.data == YT.PlayerState.PAUSED) || (event.data == YT.PlayerState.ENDED)) {
                    showOverlay();
                }
            }

            (function() {
                var overlayElement = document.getElementById("overlayElement");
                overlayElement.onclick = function(e) {
                    var el = e.target;
                    el.style.backgroundColor = "blue";
                    window.setTimeout(function() {
                        // "Play" button clicked
                        el.style.backgroundColor = "green";
                        if (overlayShown) {
                            hideOverlay();
                            if (yt) {
                                yt.playVideo();
                            }
                        } else {
                            showOverlay();
                        }
                    }, 750);
                };
            })();
        </script>
    </body>
</html>
The code is quite straightforward: The YouTube initialisation is in the topmost JavaScript block, whereas the rest of the code in the second block controls the overlay etc.

Some Final Notes

While this solution may help keep some functionality working in regards to overlaid HTML elements, it is far from ideal and just downright 'hacky'. It is not ideal, and requires an extra amount of testing (especially across different devices). I do not condone the use of such a workaround, but this is something I've had to work with for a recent project.
video overlay html5
youtube overlay aladdin
The solution, with a proper play button, looks very convincing - It should not be abused, being that the user will believe that they're interacting with a video player, and so it should act like a video player. Using the overlay poster will allow, however, the placement of ads and other objects on top of the video poster.
NB: Do not take verbatim, any code above, for the use with any production software. It should be thoroughly tested before use.
If you know of any better methods to perform the interaction I describe here, I'd love to hear about it.

Monday, January 30, 2017

bLOCK eLEMENT mODIFIER BEM


BEM is about how we structure our html and how we name our CSS / sass classes.
the idea is to divide our user interface into independent blocks. This allows us to reuse existing code without copying and pasting.

Block -  are represented by class attribute.
 - the block name describes its purpose ("What is it?" — menu or button), not its state ("What does it look like?" — red or big).
- The block shouldn't influence its environment, meaning you shouldn't set the external geometry (margin) or positioning for the block
- You also shouldn't use CSS tag or ID selectors when using BEM.
When its about Nesting Blocks
  • Blocks can be nested in each other.
  • You can have any number of nesting levels.

Element 

  • The element name describes its purpose ("What is this?" — itemtext, etc.), not its state ("What type, or what does it look like?" — redbig, etc.).
  • The structure of an element's full name is block-name__element-name. The element name is separated from the block name with a double underscore (__).
  • If a section of code might be reused and it doesn't depend on other page components being implemented, you should create a block.
  • If the section of code can't be used separately without the parent entity (the block), an element is usually created.
<div class="block">
   ...
   <span class="block__elem"></span>
 </div>

Modifier

  • The modifier name describes its appearance ("What size?" or "Which theme?" and so on — size_s or theme_islands), its state ("How is it different from the others?" — disabledfocused, etc.) and its behavior ("How does it behave?" or "How does it respond to the user?" — such as directions_left-top).
  • block-name_modifier-name
  • block-name__element-name_modifier-name
  • <div class="block block--mod">...</div>
     <div class="block block--size-big
      block--shadow-yes">...</div>

Mix

<!-- `header` block --> <header class="header"> <!-- Added the `header__button` class to the `button` block --> <button class="button header__button">...</button> </header> <!-- `form` block --> <form class="form" > <button class="button">...</button> </form>

.button { font-family: Arial, sans-serif; border: 1px solid black; }
.header__button { margin: 30px; position: relative; }



HTML implementation:
<article class="article text"></article>

<footer class="footer">
    <div class="copyright text"></div>
</footer>
CSS implementation:
.text {
    font-family: Arial, sans-serif;
    font-size: 14px;
    color: #000;
}

Sunday, January 29, 2017

javascript

Install

Working with JavaScript on the Command Line

Data Types

Collections and Loops

Functions and Scope

Unit 1 Project, Slackbot

Unit 2: The Browser and APIs

Objects and JSON

Intro to the DOM and jQuery

DOM and jQuery, continued

AJAX and APIs

Asynchronous JavaScript and Callbacks

Unit 2 Take Home Project: API Consuming App

Unit 3: Persisting Data and Advanced Topics

Advanced APIs

Prototypical Inheritance

This and Anonymous Functions

Intro to CRUD and Firebase

In-Class Lab

Unit 4: Building and Deploying Your App

Deploying Your App

Instructor/Student Choice

Lab Time

Lab Time

Final Project Presentations

Friday, January 13, 2017

svg tools

https://github.com/jonathantneal/svg4everybody

To use it now, include the script in your document.
<script src="/path/to/svg4everybody.js"></script>
<script>svg4everybody(); // run it now or whenever you are ready</script>

https://icomoon.io/

https://github.com/una/svg-icon-system-boilerplate

https://jakearchibald.github.io/svgomg/