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" | |
"encoding/csv" | |
"fmt" | |
"io" | |
"os" | |
"strings" | |
"log" |
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 ( | |
"fmt" | |
"strings" | |
) | |
/* | |
Implement: Protein synthesis |
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 "fmt" | |
/* | |
Print 2-D array in spiral order | |
numbers := [ | |
[2, 4, 6, 8], |
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 initialState = { | |
user: {} | |
} | |
export default function github(state = initialState, action) { | |
switch (action.type) { | |
case 'REQUEST_USER': | |
return { ...state, isFetchingUser: true } | |
case 'RECEIVE_USER': { | |
return { |
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 'whatwg-fetch' | |
const GITHUB_API = 'https://api.github.com' | |
function receiveUser (name, json) { | |
return { | |
type: 'RECEIVE_USER', | |
user: json | |
} | |
} |
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' | |
class SearchBar extends Component { | |
constructor (props) { | |
super(props) | |
this.state = { | |
username: '' | |
} | |
} |
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
/* | |
Given a page of text, output the characters ordered from highest to lowest occurrence. | |
for example, the output for 'banana!' is | |
a: 3 | |
n: 2 | |
b: 1 | |
!: 1 |
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
/* | |
List of elements of type/ reimplement getElementsByTagName | |
* Returns a list of all elements of given type which are children of provided parent. | |
* @param {! string} `tagName` The tag name of the element. eg. 'DIV' | |
* @param {Node} `parent` The root node under which the search must be performed. | |
* @return {!Array} A list of elements of given type that are children of provided parent. Empty if none could be found. | |
*/ |
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 test from 'tape' | |
import jobsReducer from '../src/client/reducers/jobs' | |
const actualReducer = jobsReducer | |
const initialState = { | |
list: [] | |
} | |
const initialState2 = { | |
list: [ { title: 'Actress' } ] | |
} |
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
// Write a function that is a number guessing game. It should determine a random number from 1-100, and let the user guess the number. | |
// It should report back whether their guess is correct, too high, or too low. Important: if the user guesses a number they've already | |
// guessed, it should tell them they have previously guessed this number. Until they guess the correct number, it should continue to prompt | |
// them. Once they've guessed the correct number, it should congratulate them and tell them how many guesses they took to solve the problem | |
// (minus any duplicate guesses). | |
function game() { | |
var guess = [] // store user's guesses | |
var randNum = Math.floor(Math.random() * (100)) + 1 | |
function numberGuesser(num) { |
NewerOlder