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 { BigQuery } from '@google-cloud/bigquery' | |
import * as functions from 'firebase-functions' | |
import { LoggerRow } from 'bentowidgets/utils/loggerHOC' | |
const bigquery = new BigQuery({ | |
projectId: process.env.GCLOUD_PROJECT, | |
keyFilename: `./service_keys/${process.env.GCLOUD_PROJECT}-service.json` | |
}) | |
export const logSidebarEvent = functions.https.onCall( |
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
class Solution(object): | |
def cherryPickup(self, grid): | |
previous_locs = {(0, 0, 0, 0) : grid[0][0]} | |
n = len(grid) | |
for step in range(1, 2 * (n - 1) +1): | |
if len(previous_locs) == 0: | |
return 0 | |
curr_locs = dict() | |
locs = self.get_all_possible_pos(step, grid, n) | |
print locs |
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, { useState, useRef, useContext } from 'react' | |
import { FirebaseContext } from 'bentowidgets/widgets/firebase_context' | |
import firebase from 'firebase' | |
const FirestoreCacheContext = React.createContext() | |
function FirestoreCacheProvider(props) { | |
const _firebase = useContext(FirebaseContext) | |
let cache = useRef({}).current // HACKY AF |
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, { useState, useEffect, useContext } from 'react' | |
import { FirebaseContext } from 'bentowidgets/widgets/firebase_context' | |
import firebase from 'firebase' | |
const FirestoreCacheContext = React.createContext() | |
function FirestoreCacheProvider(props) { | |
const _firebase = useContext(FirebaseContext) | |
const { children } = props |
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, { useState, useEffect, useContext } from "react" | |
import { FirebaseContext } from 'bentowidgets/widgets/firebase_context' | |
import { UserContext } from 'bentowidgets/widgets/user_context' | |
import { get } from 'lodash' | |
const ProjectContext = React.createContext() | |
function ProjectProvider(props) { |
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
if (module.hot) { | |
console.log('Google content script HOT') | |
module.hot.accept() | |
} | |
import React from 'react' | |
import PureRenderMixin from 'react-addons-pure-render-mixin' | |
import pink from '@material-ui/core/colors/pink' | |
import purple from '@material-ui/core/colors/purple' |
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 ReactDOM from 'react-dom' | |
import { sortBy, last, sortedIndexBy } from 'lodash' | |
import { RadioGroup, RadioButton } from 'react-radio-buttons' | |
let d3 = Object.assign({}, | |
require('d3-shape'), | |
require('d3-scale'), |
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 functools | |
def dec(f): | |
i = dict() | |
i['a'] = 0 | |
@functools.wraps(f) | |
def wrap(*args): | |
i['a'] = i['a'] + 1 | |
print 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
select W1.review_id, W1.index, W2.index, W1.token, W2.token | |
from index W1 INNER JOIN index W2 | |
ON ( | |
(W1.token = 'stand' AND W2.token = 'behind' AND | |
W1.review_id = W2.review_id AND | |
W1.index + 1 = W2.index) OR | |
(W1.token = 'stand' AND W2.token = 'up' AND | |
W1.review_id = W2.review_id AND | |
W1.index + 1 = W2.index) OR |
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
SELECT | |
string_agg(token, ' ') as ngram, | |
count(*) as count, | |
review_id, | |
MIN(start) AS start, MAX("end") AS end, | |
CASE | |
WHEN token = 'guy' THEN | |
index + 1 | |
WHEN token = 'stand' THEN | |
unnest(ARRAY[index, index+1]) |
NewerOlder