Skip to content

Instantly share code, notes, and snippets.

View CharlesAMoss's full-sized avatar
💭
200

Charlie Moss CharlesAMoss

💭
200
View GitHub Profile
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';
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;
let hex = '#' + Math.floor(Math.random() * 0x1000000)
.toString(16)
.padStart(6, '0');
body {
background: gainsboro;
height: 400vh;
margin: 0;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
font-family: monospace;
color: #404040;
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.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)
body {
background :#fffeb3;
/* display: flex;
justify-content: center;
align-items: center;*/
}
img {
width: 100%;
max-width: 500px;
<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>
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]
'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);