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 functions from "firebase-functions"; | |
| import admin from "firebase-admin"; | |
| // client code | |
| // firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then(function(idToken) { | |
| // }) | |
| admin.initializeApp(); | |
| /** |
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
| # Nothing to do if we aren't in a git repo | |
| if git rev-parse --git-dir > /dev/null 2>&1; then | |
| # Get the name of upstream | |
| upstream=$(command git rev-parse --symbolic-full-name --abbrev-ref @{u} 2>/dev/null) | |
| # Check if we have an upstream, and that it is different than our current branch | |
| if [[ | |
| $(command git rev-parse --symbolic-full-name --abbrev-ref @{u} 2>/dev/null | sed 's/origin\///') | |
| != $(command git rev-parse --abbrev-ref HEAD) | |
| && ! -z "$upstream" |
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 withState = connect(state => ({ | |
| visitor: getVisitor(state), | |
| form: getRegForm(state), | |
| activeUsers: getActiveUsers(state), | |
| })); | |
| const HomeData = withState((children, ...rest) => children(...rest) ); | |
| // in usage | |
| export function Home() { |
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
| function ImageGrid({ images = [], imageSelect = () => {} }) { | |
| function Img({ id = '', urls = {}, onClick = () => {}, style = {} }) { | |
| return ( | |
| <a style={style} onClick={e => onClick(urls)}> | |
| <img src={urls.small} alt="" /> | |
| </a> | |
| ); | |
| } | |
| return ( |
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 from 'react'; | |
| import styled from 'styled-components'; | |
| /** | |
| * @param {string} src | |
| * @param {string} alt | |
| * @param {number} width Some ratio you like | |
| * (Math.sqrt(5) + 1) / 2 : Golden Ratio | |
| * 16/9 : Widescreen | |
| * 2.414 : Ultra wide |
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
| func main() { | |
| resp, err := search("hats") | |
| if err != nil { | |
| println("buggered") | |
| } else { | |
| fmt.Printf("%+v\n", resp) | |
| } | |
| } |
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 ( | |
| "io" | |
| "net/http" | |
| "os" | |
| ) | |
| const ( | |
| apiVersion = "v1" |
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 ( | |
| "encoding/json" | |
| "fmt" | |
| "net/http" | |
| ) | |
| // ... | |
| func main() { | |
| url := baseURL + "/search/photos/?query=hats&client_id=" + applicationID |
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
| // PhotoResponse is thing | |
| type PhotoResponse struct { | |
| Total int `json:"total"` | |
| TotalPages int `json:"total_pages"` | |
| Results []Photo `json:"results"` | |
| } | |
| // Photo is thing | |
| type Photo struct { | |
| ID string `json:"id"` | |
| Images ImageSet `json:"urls"` |
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
| console.clear() | |
| sortPerfTable() | |
| expandPoorSuggestions() | |
| showFullText() | |
| function sortPerfTable() { | |
| const tbl = document.querySelector('.table-perfinsights tbody'); |
NewerOlder