Skip to content

Instantly share code, notes, and snippets.

View patrickspencer's full-sized avatar

Patrick Spencer patrickspencer

View GitHub Profile
@patrickspencer
patrickspencer / main_huggingface_transformer_embeddings.ipynb
Last active May 30, 2023 05:55
main_huggingface_transformer_embeddings.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@patrickspencer
patrickspencer / meetup_api_call.py
Created June 5, 2017 16:12
Accessing the meetup api with python
import pprint
import requests
# put in your api key below
api_key = ""
pp = pprint.PrettyPrinter(indent=4)
urlname = "ny-tech"
event_id = 3428886
url = "https://api.meetup.com/{}/events/{}/rsvps?key={}".format(urlname, event_id, api_key)
2.1.3 :001 > Problem.find(1).problem_template
Problem Load (0.2ms) SELECT "problems".* FROM "problems" WHERE "problems"."id" = ? LIMIT 1 [["id", 1]]
ProblemTemplate Load (0.2ms) SELECT "problem_templates".* FROM "problem_templates" WHERE "problem_templates"."problem_id" = ? LIMIT 1 [["problem_id", 1]]
## app/views/layouts/application.html.erb
<!DOCTYPE html>
<html>
<head>
<%=
if current_user.admin?
puts '<link href="/assets/application-admin.css"/>'
else
puts '<link href="/assets/application-nonadmin.css"/>'
## app/views/layouts/application.html.erb
<!DOCTYPE html>
<html>
<head>
<%=
if current_user.admin?
stylesheet_link_tag "application-admin"
else
stylesheet_link_tag "application-nonadmin"