Skip to content

Instantly share code, notes, and snippets.

Sam Schick schicks

Block or report user

Report or block schicks

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Search_QA.md

Common Questions About Search

Why are the results not in the order that I would expect?

The primary reason that results seem like they might be returned out of order is because there is a random element to the rank that we give each search document. This allows us to expose courses that might otherwise have been buried too far down the list to be seen, which both helps authors get exposure and improves the feedback that we get because we see users interact with more courses.

Won't this create an inconsistent experience for the user?

The randomness added to the query is seeded by the user id, so each time an individual user searches for something the results will be in the same order. However, if two different users attempted the same search, they might see results in different orders. This sort of behavior is fairly common among searches on marketplaces, like ecommerce websites, because it helps prevent [winner-t

View autocomplete.js
import axios from 'axios'
import config from '../../config'
const searchUrl = '/library/search?q='
const libraryCoursesUrl = '/library/courses/'
const debounce = (func, wait, immediate) => {
let timeout
return (...args) => {
const later = () => {
@schicks
schicks / default_arguments.md
Last active Jan 23, 2019
default arguments
View default_arguments.md

How Does Javascript Handle Default Arguments?

My first experience with default arguments was from Python, where there are dire warnings of the dragons you will encounter if you supply mutable values as default arguments. The concern is in Python, these arguments are initialized at the time that the function is created, which can give you some very surprising results.

def greeter(greetings={}):
  print(greetings.get('hi', 'No such greeting')
  greetings['hi'] = 'Hello World!'
@schicks
schicks / Rest.js
Last active Dec 6, 2018
Declarative data from rest apis in react
View Rest.js
//@flow
import * as React from 'react'
import axios from 'axios'
type JsonType = number | string | { [string]: JsonType } | JsonType[] | null
type Props = {
uri: string,
children: React.ComponentType<{ loading: boolean, error: boolean, data?: JsonType }>,
transform: JsonType => JsonType,
View fibonacci.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View efficiency.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@schicks
schicks / cloudSettings
Last active Jul 1, 2018
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2018-07-01T16:18:58.169Z","extensionVersion":"v2.9.2"}
@schicks
schicks / xmonad.hs
Last active Dec 16, 2015
config for xmonad on fedora 22.
View xmonad.hs
--
-- Configuration file for XMonad + MATE
--
-- Usage:
-- * Copy this file to ~/.xmonad/
-- * Run: $ xmonad --recompile
-- * Launch: $ xmonad --replace
-- [Optional] Create an autostart to command with "xmonad --replace"
--
-- Author: Arturo Fernandez <arturo at bsnux dot com>
You can’t perform that action at this time.