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
| from PIL import Image | |
| import base64 | |
| import numpy | |
| from io import BytesIO | |
| data_uri = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAS4AAAEuCAYAAAAwQP9DAAAU80lEQVR4Xu2da+hnRRnHv0qZKV42LDOt1eyGULoSJBGpRBFprBJBQrBJBBWGSm8jld5WroHUCyEXKutNu2IJ1QtXetULL0uQFCu24WoRsV5KpYvGYzM4nv6X8zu/mTnznPkcWP6XPTPzzOf7/L7/OXPmzDlOHBCAAAScETjOWbyECwEIQEAYF0kAAQi4I4BxuZOMgCEAAYyLHIAABNwRwLjcSUbAEIAAxkUOQAAC7ghgXO4kI2AIQADjIgcgAAF3BDAud5IRMAQggHGRAxCAgDsCGJc7yQgYAhDAuMgBCEDAHQGMy51kBAwBCGBc5AAEIOCOAMblTjIChgAEMC5yAAIQcEcA43InGQFDAAIYFzkAAQi4I4BxuZOMgCEAAYyLHIAABNwRwLjcSUbAEIAAxkUOQAAC7ghgXO4kI2AIQADjIgcgAAF3BDAud5IRMAQggHGRAxCAgDsCGJc7yQgYAhDAuMgBCEDAHQGMy51kBAwBCGBc5AAEIOCOAMblTjIChgAEMC5yAAIQcEcA43InGQFDAAIYFzkAAQi4I4BxuZOMgCEAAYyLHIAABNwRwLjcSUbAEIAAxkUOQAAC7ghgXO4kI2AIQADjIgcgAAF3BDAud5IRMAQggHGRAxDwTeDTkr4s6UxJ/5F0QNK3JD3lu1tbR49xLVld+jYXgcskvSTpIkmnS/qgpJMk/Tv8bHHZ7+PXPw6M5kRJx0t6Ijkv9uUsSW+U9Iykczfp4K8lfXiuztdoF+OqQZk2vBEwUzFTsK9mQNFkotGkhvFeSc+G86NRtdDfd0h6tIVASsSAcZWgSp0eCJjJ7JR0SRgZ2SjHDMp+38Jho7PXTAzkBUmvn1jWRTGMy4VMBJmBg |
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
| package main | |
| import ( | |
| "fmt" | |
| "github.com/fatih/color" | |
| "github.com/fsnotify/fsnotify" | |
| "log" | |
| "os" | |
| "path/filepath" | |
| "regexp" |
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
| import axios from 'axios'; | |
| import {toCamelCase, toSnakeCase} from '../util'; | |
| import qs from 'qs'; | |
| // You can intercept requests or responses before they are handled by then or catch. | |
| // https://github.com/axios/axios#interceptors | |
| // Add a response interceptor and camelCase return data (for JS) | |
| axios.interceptors.response.use((response) => { | |
| response.data = toCamelCase(response.data); |
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
| import React, {Component} from "react"; | |
| import {validateEmail, validateRequired} from "./validations"; | |
| class MyForm extends Component { | |
| render( | |
| return (<Input id="email" | |
| placeholder="[email protected]" | |
| label="Email (*Required)" | |
| type="text" | |
| validators={[validateEmail, validateRequired]} |
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
| --- | |
| # exists at roles/phantomjs/tasks/main.yml | |
| - name: Update repositories cache and system deps | |
| apt: name={{ item }} state=present update_cache=yes | |
| with_items: | |
| - build-essential | |
| - chrpath | |
| - libssl-dev | |
| - libxft-dev |
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
| - name: Update repositories cache and system deps | |
| apt: name={{ item }} state=present update_cache=yes | |
| with_items: | |
| - libxi6 | |
| - libgconf-2-4 | |
| - name: Install chromedriver | |
| apt: name={{ item }} state=present | |
| with_items: | |
| - chromium-chromedriver |
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
| # Add this snippet to the top of your playbook. | |
| # It will install python2 if missing (but checks first so no expensive repeated apt updates) | |
| # [email protected] | |
| - hosts: all | |
| gather_facts: False | |
| tasks: | |
| - name: install python 2 | |
| raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal) |
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
| #!/bin/bash | |
| if [[ "$1" != "" ]]; then | |
| S3BUCKETNAME="$1" | |
| else | |
| echo ERROR: Failed to supply S3 bucket name | |
| exit 1 | |
| fi | |
| aws s3 sync build s3://$S3BUCKETNAME --delete --cache-control max-age=31536000,public |
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
| handleDrop = files => { | |
| // Push all the axios request promise into a single array | |
| const uploaders = files.map(file => { | |
| // Initial FormData | |
| const formData = new FormData(); | |
| formData.append("file", file); | |
| formData.append("tags", `codeinfuse, medium, gist`); | |
| formData.append("upload_preset", "pvhilzh7"); // Replace the preset name with your own | |
| formData.append("api_key", "1234567"); // Replace API key with your own Cloudinary key | |
| formData.append("timestamp", (Date.now() / 1000) | 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
| +import moment from "moment/moment"; | |
| + | |
| +// | |
| + | |
| +class CachedResource { | |
| + constructor( | |
| + cachedResourceKey, | |
| + cachedTimestampKey, | |
| + source, | |
| + dirtyFunc, |