This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rest.service.ts | |
| import { Injectable } from '@angular/core'; | |
| import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http'; | |
| @Injectable({ | |
| providedIn: 'root' | |
| }) | |
| export class RestService { | |
| XKCD_URL = 'https://xkcd.com'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| document.addEventListener( 'wpcf7submit', function( event ) { | |
| var inputs = event.detail.inputs; | |
| var first = ''; | |
| var second = ''; | |
| for ( var i = 0; i < inputs.length; i++ ) { | |
| if ( 'your-email' === inputs[i].name ) { | |
| first = inputs[i].value; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let hex = '#' + Math.floor(Math.random() * 0x1000000) | |
| .toString(16) | |
| .padStart(6, '0'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| body { | |
| background: gainsboro; | |
| height: 400vh; | |
| margin: 0; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| text-align: center; | |
| font-family: monospace; | |
| color: #404040; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const entry = document.getElementById("entry"); | |
| // every journey begins with one step | |
| const svg = document.createElement("svg"); | |
| svg.setAttribute("width", "100%"); | |
| svg.setAttribute("height", "100%"); | |
| const g = document.createElement("g"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| this.size = 31 * (alpha.indexOf(arr.map( y => y.split('id="').pop().split('.').shift()) | |
| .sort((a,b) => a.length - b.length || a.localeCompare(b)).pop()) + 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| body { | |
| background :#fffeb3; | |
| /* display: flex; | |
| justify-content: center; | |
| align-items: center;*/ | |
| } | |
| img { | |
| width: 100%; | |
| max-width: 500px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <form> | |
| <div> | |
| <input type="checkbox" value="this one"> | |
| <label for="this one">This</label> | |
| </div> | |
| <div> | |
| <input type="checkbox" value="that one"> | |
| <label for="that one">That</label> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const isPrime = N => { | |
| return (N > 1) && Array.apply(0, Array(1 + ~~Math.sqrt(N))). | |
| every((x, y) => (y < 2) || (N % y !== 0)); | |
| } | |
| const primeTime = N => ([...Array(N).keys()].filter(isPrime)); | |
| primeTime(10); | |
| // output [2,3,5,7] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| let getDeck = () => { | |
| let deck = []; | |
| const numVal = _.range(2, 11).map(String); | |
| const faceVal = ['J', 'Q', 'K', 'A']; | |
| const value = numVal.concat(faceVal); | |
| const suits = ['♠', '♥', '♣', '♦']; | |
| for (var suit of suits) { | |
| const cards = value.map(val => val + suit); | |
| deck.push(cards); |
NewerOlder