This file contains 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
#!bash | |
# | |
# bash/zsh completion support for core Git. | |
# | |
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]> | |
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). | |
# Distributed under the GNU General Public License, version 2.0. | |
# | |
# The contained completion routines provide support for completing: | |
# |
This file contains 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 ( | |
"bufio" | |
"net" | |
) | |
type Client struct { | |
incoming chan string | |
outgoing chan string |
This file contains 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 map from 'lodash/map'; | |
import Promise from 'bluebird'; | |
function isNode({ key, type, linkType } = {}) { | |
return (key === 'sys' && type === 'Link' && (linkType === 'Entry' || linkType === 'Asset')); | |
} | |
// TODO: combine these somehow |
This file contains 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 splice(arr, pos) { | |
let nArr = Array.from(arr); | |
return [ nArr.splice(pos,1), nArr ]; | |
} | |
function p(arr, result = [], chr = []){ | |
if (arr.length === 1) result.push(chr.concat(arr).join('')); | |
for (let i = 0; i <= arr.length-1; i++) { | |
const [c, n] = splice(arr,i); | |
p(n,result,chr.concat(c)); |
This file contains 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 CLIENT_ID = <CLIENT_ID>; | |
const CLIENT_SECRET = <CLIENT_SECRET>; | |
// Hardcoded dummy redirect URI for non-web apps. | |
const REDIRECT_URI = 'urn:ietf:wg:oauth:2.0:oob'; | |
// The URL root for accessing Google Accounts. | |
const GOOGLE_ACCOUNTS_BASE_URL = 'https://accounts.google.com'; | |
const path = require('path'); |
This file contains 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 gql from "graphql-tag"; | |
import { graphql, ChildDataProps } from "react-apollo"; | |
type Response = { | |
users: [User]; | |
}; | |
type Variables = { | |
q: string; |
This file contains 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
/* | |
A builder is looking to build a row of N houses that can be of K different | |
colors. He has a goal of minimizing cost while ensuring that no two neighboring | |
houses are of the same color. | |
Given an N by K COSTS where the nth row and kth column represents the cost to |
This file contains 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 parse_json(jsonStr) { | |
let tokens = []; | |
for (let i = 0; i < jsonStr.length; i++) { | |
if (jsonStr[i] === '"') { | |
value = ''; | |
i++ ; | |
while (jsonStr[i] !== '"') { | |
value += jsonStr[i]; |
This file contains 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 Graph { | |
constructor(){ | |
this.nodes = {}; | |
} | |
addNode(n){ | |
if (!this.nodes[n]) this.nodes[n] = []; | |
} | |
addDirEdge(a,b){ |
This file contains 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 Graph { | |
constructor(){ | |
this.nodes = {}; | |
} | |
addNode(n){ | |
if (!this.nodes[n]) this.nodes[n] = []; | |
} |
OlderNewer