JavaScript

Disabling javascript on sites with pop-ups also might help.

Taggings:

Geb provides access to JavaScript variables and also allows to run JavaScript on the page. With help of that feature properties can be accessed and actions can be performed (click, etc.)

Syntax: js.exec()

Import Javascript libraries into Angular 2

I had and still have not much experience in web engineering (Javascript, npm-Tool, …) when I started working with Angular 2. There I have a problem that normally one imports an angular-module with e.g. “import {Injectable} from '@angular/core';”. But I want to use the Javascript-library “cytoscape.js”. The problem now is, how to import it such that I can use it.

Display the developper option in an iOS device while running a React Native app.

The best way to solve this challenge would be follow the following steps:
1. Make sure that you have set the proper location for your Javascript code in your AppDelegate.m file. You can choose between load the cod from the development server that runs in your computer or from a pre-bundled file on disk.

2. Go to the menu Product > Scheme > Manage Schemes, and from there you can set the options you want to enable for every different scheme that your app has (Build, Run, Test, Profile...).

3. Make sure that you set the build configuration to Debug. This will enable the developer menu in the target.

4. If you want to access the developer menu you have to shake your phone and it'll automatically show up in your screen.

Taggings:

Deal with different versions of Node installed in your system.

The best way to deal with different versions of node is to install the Node Version Manager (nvm) using Homebrew.
You just need to write the following command in your terminal:

brew update
brew install nvm
mkdir ~/.nvm
nano ~/.bash_profile

and make sure that you add this to your .bash_profile:

export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh

Now you can just use the command nvm from your terminal to simply install and manage new versions of Node in your computer.

Taggings:

Perform A/B testing using Javascript

On checkout page include small Javascript script which is going to send to server which button is clicked.
Create two versions of checkout page (both with different colors of ,,Cancel" button)

Serve each version to 50% of visitors (every second visitor gets one version).

Count how many times user clicked on each button. Version that has less clicks on ,,Cancel" button gives better solution for design of Cancel button.

Developing a blogger.com gadget that displays both, an image and the title of the most recent post

The steps do do so would be the following:

  1. Look up the internet for getting started documentation for blogger.com gadgets (Blogger documentation)
  2. Write a helloworld gadget and try to upload the gadget to your blog (add the helloWorld Gadget to your ftp, add it then to your layout by choosing "Layout" and clicking the following, at last enter an URL and hit the "add url" button)
  3. if the upload was successful look up how one can get the image link and the title of the most recent post programmatically
  4. search the web how to display an image and a title with xhtml
  5. search the web how to style the previsouly mentioned tags with css accordingly
  6. put the pieces together and test
  7. iterate until the desired outcomes are archieved
  8. upload the solution to your blog

In order to get a kick start, here the helloWorld.xml


<?xml version="1.0" encoding="UTF-8" ?>

Description of the structure:

  • ModulePrefs: Here preferences for the gadget can be defined, which can then be used within your code
  • your custom HTML, CSS and JavaScript all goes into the Content part. as CDATA

Taggings:

Replacing String in JavaScript with Regular Expression and the replace function

steps:

  1. searching the web for replacing texts
  2. finding regular expression
  3. searching for suitable regex function
  4. identifying replace out of (match, exec, replace) as the most suitable function to use
  5. searching for example how to use replace the right way
  6. finding and testing the right pattern that matches /s200/
  7. testing and iterating until the pattern matches the string and the modified string is ready to use

a javascript solution for that particular challenge looks the following way:


var testString = "http://www.google.at/img/s200/";
var partToBeReplaced = /s200/;
var newPart = "s1600";
var replacedTestString = testString.replace(partToBeReplaced, newPart);

Taggings:

How to find a partial String in another String with JavaScript

I've got a string lets say its "/s200/" which is part of a URL, and this part is responsible for resizing an image on demand. So whenever you change s200 to a higher or lower number following the s, then the picture that is returned by the complete URL will be either increased or decreased in size. Now i want to programmatically find this part in the url and replace it by lets say "/s800/" in order to make the returned image bigger.

Developing a blogger.com gadget that displays both, an image and the title of the most recent post

The steps do do so would be the following:

  1. Look up the internet for getting started documentation for blogger.com gadgets (Blogger documentation)
  2. Write a helloworld gadget and try to upload the gadget to your blog (add the helloWorld Gadget to your ftp, add it then to your layout by choosing "Layout" and clicking the following, at last enter an URL and hit the "add url" button)
  3. if the upload was successful look up how one can get the image link and the title of the most recent post programmatically
  4. search the web how to display an image and a title with xhtml
  5. search the web how to style the previsouly mentioned tags with css accordingly
  6. put the pieces together and test
  7. iterate until the desired outcomes are archieved
  8. upload the solution to your blog

In order to get a kick start, here the helloWorld.xml


<?xml version="1.0" encoding="UTF-8" ?>

Description of the structure:

  • ModulePrefs: Here preferences for the gadget can be defined, which can then be used within your code
  • your custom HTML, CSS and JavaScript all goes into the Content part. as CDATA

Taggings:

Pages

Subscribe to JavaScript