The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.
Send messages to iframe using iframeEl.contentWindow.postMessage
Recieve messages using window.addEventListener('message')
| # | |
| # Working with branches | |
| # | |
| # Get the current branch name (not so useful in itself, but used in | |
| # other aliases) | |
| branch-name = "!git rev-parse --abbrev-ref HEAD" | |
| # Push the current branch to the remote "origin", and set it to track | |
| # the upstream branch | |
| publish = "!git push -u origin $(git branch-name)" |
| import com.fasterxml.jackson.databind.{DeserializationFeature, ObjectMapper} | |
| import com.fasterxml.jackson.module.scala.experimental.ScalaObjectMapper | |
| import com.fasterxml.jackson.module.scala.DefaultScalaModule | |
| object JsonUtil { | |
| val mapper = new ObjectMapper with ScalaObjectMapper | |
| mapper.registerModule(DefaultScalaModule) | |
| mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) | |
| def toJson(value: Map[Symbol, Any]): String = { |
| from PIL import Image | |
| def scale(image, max_size, method=Image.ANTIALIAS): | |
| """ | |
| resize 'image' to 'max_size' keeping the aspect ratio | |
| and place it in center of white 'max_size' image | |
| """ | |
| im_aspect = float(image.size[0])/float(image.size[1]) | |
| out_aspect = float(max_size[0])/float(max_size[1]) | |
| if im_aspect >= out_aspect: |
| // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
| // Hooking up the middleware with the express app | |
| // In app.js | |
| // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
| var forceSSL = require('../middleware/ssl').force(config.hostname); | |
| if ('production' == app.get('env')) { | |
| app.use(forceSSL); | |
| } |
| using System; | |
| using System.Threading; | |
| static class Program { | |
| static void Main() { | |
| Console.Write("Performing some task... "); | |
| using (var progress = new ProgressBar()) { | |
| for (int i = 0; i <= 100; i++) { | |
| progress.Report((double) i / 100); |
| Note for newcomers: | |
| In the shortcuts below, "C" stands for CTRL and "A" stands for "ALT". This is a convention | |
| used in the Midnight Commander documentation and was kept here. | |
| You can also use "ESC" instead of "ALT", which is useful on Macbooks. | |
| Main View | |
| --------------------------------------------------------------- | |
| - File/directory operations |
| // Password strengths | |
| export const enum PasswordCheckStrength { | |
| Short, | |
| Common, | |
| Weak, | |
| Ok, | |
| Strong, | |
| }; | |
| // Object to check password strengths and various properties |