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
export default function(organizationName: string) { | |
const [f, l]: string[] = organizationName.split(' ') | |
return [f.charAt(0).toUpperCase(), (l || '').charAt(0).toUpperCase()].join('') | |
} |
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 * as React from 'react' | |
import { Subscribe as UnstatedSubscribe } from 'unstated' | |
import { AuthContainer } from '@app/containers' | |
import { TAuthContainerUserData } from '@app/containers/AuthContainer' | |
import { Redirect } from '@reach/router' | |
import authOnly from './permission-auth-only' | |
import guestOnly from './permission-auth-only' | |
interface IPermissionFunction { | |
guard: (user: TAuthContainerUserData) => 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
function solution(A) { | |
var natural = Array.from(new Array(10000)).map((_, i) => i + 1) | |
return natural.sort((a, b) => a - b).find((n) => !A.includes(n)) | |
} | |
console.log(solution([1,2,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
function obj2arr(obj) { | |
var arr = [] | |
function flatten (subobj, isRoot) { | |
var result = {} | |
Object.keys(subobj).forEach(key => { | |
if (typeof subobj[key] === 'object') { | |
flatten(subobj[key], false) | |
} else { | |
result[key] = subobj[key] |
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
x.sort((a, b) => z(a) > z(b)) | |
function z(str) { | |
return (<h4 style="text-align: center;">)[A-Za-z\,\s]+(<\/h4>)/.exec(str)[0].replace('<h4 style="text-align: center;">', '').replace('</h4>', '').replace(', CA', '') | |
} |
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
{ | |
"id": 1, | |
"name": "sample 1", | |
"child": [ | |
{ | |
"id": 12, | |
"name": "sample 12", | |
"child": [], | |
"parentId": 1 | |
}, |
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
var els = Array.from( | |
document.querySelectorAll(".rls-info-container .link-1080p .hs-magnet-link a") | |
); | |
var links = '' | |
for (let i = 0; i < els.length; i++) { | |
var prefix = i === 0 ? '' : '\n\n' | |
var magnet = els[i]; | |
links += `${prefix}${magnet.href}` |
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
/* @flow */ | |
/** | |
* Chunks an array in a specific pattern | |
* @example chunkPattern(['haha', 'haha', 'haha', 'haha', 'haha', 'haha', 'haha', 'haha', 'haha'], [2, 3]) | |
* @return Array<Array<*>> | |
*/ | |
function chunkPattern(array: Array<*>, pattern: Array<number>): Array<Array<*>> { | |
const result: Array<Array<*>> = [] |
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 ( | |
"encoding/xml" | |
"fmt" | |
) | |
const data = `<?xml version="1.0" encoding="utf-8"?> | |
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | |
<soap:Body> |
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 ( | |
"bytes" | |
"regexp" | |
"encoding/json" | |
) | |
type PascalSnakeMarshaller struct { | |
Value interface{} |