Skip to content

Instantly share code, notes, and snippets.

View terrafied's full-sized avatar
💭
Shopping for cute shoes

Terra Metta terrafied

💭
Shopping for cute shoes
  • The Trans Agenda
  • 62 West Wallaby St., The Shire
View GitHub Profile
def live_release(course_id, do_emails = true, do_push = true)
course = Course.find course_id
emails_sent = pushes_sent = 0
enrollments = course.enrollments.where(is_complete: false).each do |e|
# check the course for new questions and add them to the enrollment
e.last_new_introduced = nil
e.check_questions
@rwrrll
rwrrll / gist:a37d0ec2858b78a334ac
Created January 25, 2016 15:16
Change Google Apps primary domain (Ruby google-api-client gem)
require 'google/apis/admin_directory_v1'
require 'googleauth'
require 'googleauth/stores/file_token_store'
require 'fileutils'
OOB_URI = 'urn:ietf:wg:oauth:2.0:oob'
APPLICATION_NAME = 'Directory API Ruby Quickstart'
CLIENT_SECRETS_PATH = 'client_secret.json'
CREDENTIALS_PATH = File.join(Dir.home, '.credentials', "admin-directory_v1-ruby-quickstart.yaml")
@heyellieday
heyellieday / scraper.rb
Created May 3, 2015 05:56
Medium Web Scraper
require "mechanize"
require "nokogiri"
require 'json'
require "awesome_print"
def get_latest
url = "http://medium.com/@heyellieday"
agent = Mechanize.new { |agent| agent.user_agent_alias = "Mac Safari" }
html = agent.get(url).body
@vegasgeek
vegasgeek / gist:5701400
Created June 3, 2013 21:04
A custom search for @alfredapp to search Flickr for photos licensed under Creative Commons
alfred://customsearch/Flickr%20Creative%20Commons/flickr/utf8/plus/http://www.flickr.com/search/?q={query}&l=cc&ss=2&ct=0&mt=all&w=all&adv=1
@mikeyk
mikeyk / gist:1329319
Created October 31, 2011 22:56
Testing storage of millions of keys in Redis
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])
import re
# http://atomboy.isa-geek.com/plone/Members/acoil/programing/double-metaphone
from metaphone import dm as double_metaphone
# get the Redis connection
from jellybean.core import redis
import models
# Words which should not be indexed