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
Round.find(1).guesses.select(:card_id).where(correct: true).distinct |
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
self.guesses.select(:card_id).group(:card_id).having("count(*) = 1").length | |
#returns number of correct cards on first guess. |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
{"latitude":37.8267,"longitude":-122.4233,"timezone":"America/Los_Angeles","offset":-7,"currently":{"time":1493401688,"summary":"Clear","icon":"clear-day","nearestStormDistance":290,"nearestStormBearing":63,"precipIntensity":0,"precipProbability":0,"temperature":63.04,"apparentTemperature":63.04,"dewPoint":44.49,"humidity":0.51,"windSpeed":8.04,"windBearing":339,"visibility":10,"cloudCover":0.17,"pressure":1018.03,"ozone":299.31},"minutely":{"summary":"Clear for the hour.","icon":"clear-day","data":[{"time":1493401680,"precipIntensity":0,"precipProbability":0},{"time":1493401740,"precipIntensity":0,"precipProbability":0},{"time":1493401800,"precipIntensity":0,"precipProbability":0},{"time":1493401860,"precipIntensity":0,"precipProbability":0},{"time":1493401920,"precipIntensity":0,"precipProbability":0},{"time":1493401980,"precipIntensity":0,"precipProbability":0},{"time":1493402040,"precipIntensity":0,"precipProbability":0},{"time":1493402100,"precipIntensity":0,"precipProbability":0},{"time":1493402160,"pre |
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
/* | |
Copyright 2017 Bryan Keller (https://github.com/widget-) | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software | |
distributed under the License is distributed on an "AS IS" BASIS, | |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
See the License for the specific language governing permissions and |
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
/* body{ | |
background: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet) !important; | |
} | |
p, span, h1, h2, h3, h4, h5, div, section, article, body { | |
font-family: "Comic Sans MS", cursive, sans-serif !important; | |
} | |
.member_image{ | |
-webkit-animation: spinToWin 5s infinite; | |
animation: spinToWin 5s infinite; |
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 BloomFilter { | |
static DEFAULT_HASH_FN(size) { | |
return (hex) => { | |
const hex32 = XXH.h32(hex); | |
return (string) => { | |
return Math.abs(hex32.update(string).digest().toNumber() % size); | |
}; | |
}; | |
} | |
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 preorderTraverse = (node) => { | |
if(!node){ | |
return []; | |
} | |
return [node.value, ...preorderTraverse(node.left), ...preorderTraverse(node.right)]; | |
}; | |
const inorderTraverse = (node) => { | |
if(!node){ | |
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
// create a function that accepts two paraments: an empty maze and a starting coordinate | |
// the maze will be an array of arrays of objects. the objects will look like: | |
// { | |
// "n": true, | |
// "e": true, | |
// "s": true, | |
// "w": true, | |
// "visited": false | |
// } | |
// |
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 Node { | |
constructor(){ | |
this.trie = {}; | |
} | |
static traverseChildren(word, node){ | |
if(!Object.keys(node).length){ | |
return word; | |
} | |
return Object.keys(node) |
OlderNewer