This file contains 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
var d3 = require("d3"); | |
var d3tip = require('d3-tip')(d3); | |
//--------------------------------- | |
const tip = d3tip | |
.attr('class', 'd3-tip') | |
.offset([-10, 0]) | |
.html(function (d) { | |
const date = new Date(d[0]); | |
const year = date.getFullYear(); | |
const month = months[date.getMonth()]; |
This file contains 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
import { Injectable } from '@angular/core'; | |
import { Http, Response, Jsonp, URLSearchParams } from '@angular/http'; | |
@Injectable() | |
export class GeolocationService { | |
constructor(private jsonp: Jsonp) { } | |
getLocation = (position) => { |
This file contains 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
<section class="leader-table"> | |
<h2>All Time Leaderboard</h2> | |
<table class="table-hover table-striped"> | |
<thead> | |
<tr> | |
<th colspan="2">Camper</th> | |
<th>Points in past 30 days</th> | |
<th>All time Points</th> | |
</tr> | |
</thead> |
This file contains 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
import { Component, OnInit } from '@angular/core'; | |
import { Camper } from '../../classes/camper'; | |
import { AllTimeService } from '../../services/all-time.service'; | |
@Component({ | |
selector: 'app-all-time', | |
templateUrl: './all-time.component.html', | |
styleUrls: ['./all-time.component.scss'] | |
}) | |
export class AllTimeComponent implements OnInit { |
This file contains 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
import { Injectable } from '@angular/core'; | |
import { Http, Response } from '@angular/http'; | |
@Injectable() | |
export class AllTimeService { | |
constructor(private http: Http) { } | |
getCampers = () => { | |
let apiUrl: string = 'https://fcctop100.herokuapp.com/api/fccusers/top/alltime'; |
This file contains 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
<div id="pre-marked" class="preview"> | |
<textarea [(ngModel)]="input" name="text" class="text" ></textarea> | |
</div> | |
<div></div> | |
<div id="marked" class="preview"> | |
<div innerHtml={{input|mark}} name="text-marked" class="text" ></div> | |
</div> |
This file contains 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
import { Pipe, PipeTransform } from '@angular/core'; | |
var marked = require('marked'); | |
@Pipe({ | |
name: 'mark' | |
}) | |
export class MarkPipe implements PipeTransform { | |
transform(value: any, args?: any): any { | |
marked.setOptions({ sanitize: true}); |
This file contains 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
// Bonfire: Exact Change | |
// Author: @p1xt | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-exact-change | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function drawer(price, cash, cid) { | |
var change = []; | |
var types = ['PENNY', | |
'NICKEL', | |
'DIME', |
This file contains 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
/** | |
* diff two arrays - return the elements that occur in one but not both input arrays | |
* note to self: This works but there has to be a better (more performant) solution | |
* Revisit this and look into removing items from both arrays as they're discovered | |
**/ | |
function diff(arr1, arr2) { | |
// get the items from arr1 that aren't in arr2 | |
var filteredArr1 = arr1.filter( function( el ) { | |
return arr2.indexOf( el ) < 0; | |
} ); |