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
# STEP 1 | |
# | |
# Install tailwind. We need the force flag because the angular builder | |
# has a peer dependency on tailwind ^2.0.0 || ^3.0.0 | |
# Issue to address this: https://github.com/angular/angular-cli/issues/27585 | |
# | |
$ npm i -D tailwindcss@next @tailwindcss/postcss@next --force | |
# STEP 2 | |
# |
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 { useEffect, useRef } from 'react' | |
// playground: https://stackblitz.com/edit/react-ts-nv5fxe?file=App.tsx | |
export default function App() { | |
// create a ref and declare an instance for each countUp animation | |
const countupRef = useRef(null); | |
let countUpAnim; | |
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 Foundation | |
import CoreLocation | |
struct randomLocations { | |
// create random locations (lat and long coordinates) around user's location | |
func getMockLocationsFor(location: CLLocation, itemCount: Int) -> [CLLocation] { | |
func getBase(number: Double) -> Double { | |
return round(number * 1000)/1000 |
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
<script> | |
/** | |
* You can use CountUp directly like this: | |
*/ | |
import { onMount } from 'svelte'; | |
import { CountUp } from 'countup.js'; | |
let targetEl, countUpAnim | |
onMount(() => { |
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
// Dependency: CountUp.js: https://github.com/inorganik/CountUp.js | |
(function ($) { | |
$.fn.countup = function (params) { | |
// make sure dependency is present | |
if (typeof CountUp !== 'function') { | |
console.error('countUp.js is a required dependency of countUp-jquery.js.'); | |
return; | |
} |
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 } from '@angular/core'; | |
import { FormControl, Validators } from '@angular/forms'; | |
import { HttpClient, HttpParams } from '@angular/common/http'; | |
interface MailChimpResponse { | |
result: string; | |
msg: string; | |
} | |
@Component({ |
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
getUsersLocale(defaultValue: string): string { | |
if (typeof window === 'undefined' || typeof window.navigator === 'undefined') { | |
return defaultValue; | |
} | |
const wn = window.navigator as any; | |
let lang = wn.languages ? wn.languages[0] : defaultValue; | |
lang = lang || wn.language || wn.browserLanguage || wn.userLanguage; | |
return lang; | |
} |
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 { | |
AbstractControl, | |
AsyncValidatorFn, | |
ValidationErrors, | |
ValidatorFn, | |
Validators, | |
} from '@angular/forms'; | |
export class CustomValidators { | |
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
// smash Medium's clap button the max number of times | |
function simulateClick(node) { | |
var md = document.createEvent('MouseEvents'); | |
md.initEvent('mousedown', true, false); | |
node.dispatchEvent(md); | |
var mu = document.createEvent('MouseEvents'); | |
mu.initEvent('mouseup', true, false); | |
node.dispatchEvent(mu); | |
} |
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
{"lastUpload":"2020-07-17T20:23:56.317Z","extensionVersion":"v3.4.3"} |
NewerOlder