Skip to content

Instantly share code, notes, and snippets.

View xmunoz's full-sized avatar
💜

Cristina xmunoz

💜
  • Quito
View GitHub Profile
@xmunoz
xmunoz / gcal
Created May 24, 2013 00:41
Google Device Authentication and Google Calendar API requests.
root@artemis:~# curl -d "client_id={ID}.apps.googleusercontent.com&scope=https://www.googleapis.com/auth/calendar" https://accounts.google.com/o/oauth2/device/code
{
"device_code" : {DEVICE_CODE},
"user_code" : {USER_CODE},
"verification_url" : "http://www.google.com/device",
"expires_in" : 1800,
"interval" : 5
}
root@artemis:~#curl -d "client_id={ID}.apps.googleusercontent.com&client_secret={SECRET}&code={DEVICE_CODE}&grant_type=http://oauth.net/grant_type/device/1.0" https://accounts.google.com/o/oauth2/token
@xmunoz
xmunoz / schema
Last active December 25, 2015 13:19
intag article schema
DROP TABLE IF EXISTS `articles`;
CREATE TABLE `articles` (
`alias` VARCHAR(64) NOT NULL,
`author` TEXT NOT NULL,
`title` TEXT NOT NULL,
`intro` TEXT NOT NULL,
`body` TEXT NOT NULL,
`date` DATE NOT NULL,
PRIMARY KEY (`alias`)
@xmunoz
xmunoz / permute.py
Created October 26, 2013 01:21
recursive permutations with memoization
#!/usr/bin/env python
import sys
import timing
from pprint import pprint
'''
Recurse elements in passed in string.
'''
@xmunoz
xmunoz / dead_links.go
Last active August 29, 2015 14:22
Finding dead links of underwater rugby teams
import random
from copy import deepcopy
class Piece:
def __init__(self, display, stuck = False):
self.display = display
self.stuck = stuck
# 4 x 4
self.height = len(display)
self.width = len(display[0])
@xmunoz
xmunoz / molcajete.jl
Created October 8, 2016 15:21
try to learn julia
__precompile__()
module Molcajete
import Requests: get, post, put, delete, options, json
global base_url = "https://api.meetup.com/"
if !haskey(ENV, "MEETUP_API_TOKEN")
error("MEETUP_API_TOKEN environment variable is required.")
@xmunoz
xmunoz / .gitconfig
Created October 10, 2016 20:27
gitconfig
[push]
default = current
[user]
name = Cristina Munoz
email = hi@xmunoz.com
[core]
editor = /usr/local/bin/vim
pager = less
@xmunoz
xmunoz / recurse_server.py
Last active November 8, 2016 20:55
recurse center pairing interview
from http.server import HTTPServer, BaseHTTPRequestHandler
import re
HOST, PORT = "localhost", 4000
INPUTS = {}
class HashHandler(BaseHTTPRequestHandler):
# assuming the challenge refers to HTTP GET requests
def do_GET(self):
regex = r"/(set|get)\?(\w+)=(\w+)"
let buttons = `<button type="button" class="btn btn-warning lessFields"><span class="glyphicon glyphicon-minus"></span></button>
<button type="button" class="btn moreFields"><span class="glyphicon glyphicon-plus"></span></button>`;
prefillFields();
$(".moreFields").click(function() {
console.log("on click moreFields");
// TODO: refactor to permit more than 10 filters
var step = parseInt($(".moreFields").parent().get(0).id.slice(-1)[0]);
addNewField(step + 1);
this.remove();