Skip to content

Instantly share code, notes, and snippets.

@RuolinZheng08
RuolinZheng08 / backtracking_template.py
Last active November 20, 2025 09:28
[Algo] Backtracking Template & N-Queens Solution
def is_valid_state(state):
# check if it is a valid solution
return True
def get_candidates(state):
return []
def search(state, solutions):
if is_valid_state(state):
solutions.append(state.copy())
@fpeterschmitt
fpeterschmitt / django_silk_management_commands.py
Last active May 7, 2021 08:03
Allow Django SILK to be used in a django management command
from io import StringIO
from django.core.handlers.wsgi import WSGIRequest
from django.http import HttpResponse
from silk.middleware import SilkyMiddleware
from silk.profiling.profiler import silk_profile
class silk_middleware:
"""
@aparrish
aparrish / understanding-word-vectors.ipynb
Last active December 18, 2025 05:55
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@monicao
monicao / react.md
Last active February 23, 2021 19:07
React Lifecycle Cheatsheet

React Component Lifecycle

  • getInitialState
  • getDefaultProps
  • componentWillMount
  • componentDidMount
  • shouldComponentUpdate (Update only)
  • componentWillUpdate (Update only)
  • componentWillReceiveProps (Update only)
  • render