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
async function refresh(dispatch: Dispatch, getState: () => MyState): Promise<void> { | |
const { auth: { authenticated, refresh_token: refresh } } = getState(); | |
if (!authenticated) | |
return; | |
try { | |
const { access_token, refresh_token, token_type } = await (async () => { | |
const res = await fetch(`${baseUrl}/oauth2/token`, { | |
method: 'POST', |
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
.my-cell { | |
position: relative; | |
height: 64px; | |
width: 100%; | |
margin-top: 1rem; | |
margin-bottom: 1rem; | |
.my-cell-content { | |
position: absolute; | |
top: 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 React, { Component } from 'react'; | |
import Hammer from 'hammerjs'; | |
import './Gallery.scss'; | |
interface Props<T> { | |
sensitivity?: number; | |
slides: T[]; | |
template: (slide: T) => JSX.Element; | |
} |
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, CSSProperties } from 'react'; | |
export interface Props { | |
'className'?: string; | |
'style'?: CSSProperties; | |
'src': string; | |
'data-src': string; | |
[key: string]: any; | |
} |
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 get from 'lodash/get'; | |
import EmptyListPlaceholder from './list/EmptyListPlaceholder'; | |
import Loading from './list/Loading'; | |
import './list/List.scss'; | |
interface Props<T> { | |
className?: string; | |
grid?: boolean; |
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 Foundation | |
// Returns true iif a in contained by b :) | |
// This is a modification of the longest common subsequence problem | |
func contains(a: [String], b: [String]) -> Bool { | |
var res: [[Int]] = Array.init(repeating: Array.init(repeating: 0, count: b.count), count: a.count) | |
for i in 0...a.count - 1 { | |
for j in 0...b.count - 1 { | |
if a[i] == b[j] { |
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 Foundation | |
func max(a: Int, b: Int) -> Int { | |
return a > b ? a : b | |
} | |
// Assume this one works just fine, since I copied it | |
func pedritoBt(markers: Int, floors: Int) -> Int { | |
if floors <= 1 { | |
return floors |
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 Foundation | |
func calcNoise(standingOn: Character) -> Int { | |
switch standingOn { | |
case "A": | |
return 1 | |
case "S": | |
return 3 | |
case "H": | |
return 5 |
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 Foundation | |
func min(array: [Int]) -> Int { | |
var ret = Int.max; | |
for i in 0...array.count - 1 { | |
if array[i] < ret { | |
ret = array[i] | |
} | |
} |
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 Foundation | |
func max(a: Int, b: Int) -> Int { | |
return a > b ? a : b | |
} | |
func necklace(pearls: [[Int]]) -> [[Int]] { | |
var res = Array.init(repeating: Array.init(repeating: 0, count: 151), count: pearls.count) | |
var ret: [[Int]] = [] | |