Skip to content

Instantly share code, notes, and snippets.

@alyssaq
alyssaq / es7_async.js
Created April 6, 2015 11:18
ES7 async
function get(url) {
return new Promise(function(resolve, reject) {
var req = new XMLHttpRequest();
req.open('GET', url);
req.setRequestHeader('User-Agent', 'mralexgray');
req.onload = function() {
if (req.status == 200) {
resolve(JSON.parse(req.response));
}
@alyssaq
alyssaq / s3_cors.xml
Last active February 13, 2024 07:55
AWS S3 Cors Configuration
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>DELETE</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
import numpy as np
import matplotlib.pyplot as plt
def plot_points(matrix, ls='--', lw=1.2, colors=None):
"""
Plots a 2xn matrix where 1st row are the x-coordinates
and 2nd row are the y-coordinates.
Parameters:
matrix - 2xn matrix
@alyssaq
alyssaq / plot_matrix_rotating.py
Last active August 29, 2015 14:12
Identity matrix linear transformations
import matplotlib.pyplot as plt
ax = plt.axes()
ax.arrow(0, 0, 1, 0, head_width=0.05, head_length=0.1, fc='k', ec='k', zorder=20)
ax.arrow(0, 0, 0, 1, head_width=0.05, head_length=0.1, fc='k', ec='k', zorder=20)
ax.arrow(0, 0, np.cos(np.deg2rad(-30)), np.sin(np.deg2rad(-30)), head_width=0.05, head_length=0.1, fc='r', ec='r', zorder=10)
ax.arrow(0, 0, -np.sin(np.deg2rad(-30)), np.cos(np.deg2rad(-30)), head_width=0.05, head_length=0.1, fc='r', ec='r', zorder=10)
ax.spines['left'].set_position('zero')
ax.spines['right'].set_color('none')
@alyssaq
alyssaq / auth0-widget.js
Created October 24, 2014 18:25
auth0-widget
$(document).ready(function() {
var widget = new Auth0Widget({
domain: 'xxx.auth0.com',
clientID: 'CLIENTID',
callbackURL: window.location.href,
callbackOnLocationHash: true
});
var result = widget.parseHash(location.hash);
if (result && result.id_token) {
@alyssaq
alyssaq / index.html
Created September 22, 2014 10:57
Labels on stickies css http://jsbin.com/wafamo/2
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<script src="http://cdnjs.cloudflare.com/ajax/libs/three.js/r61/three.min.js"></script>
<canvas id="debug" style="position:absolute; left:100px"></canvas>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
.stickies {
@alyssaq
alyssaq / delete.md
Last active August 29, 2015 14:06
Delete github branch
$ git branch -d <feature-branch>
$ git push origin :<feature-branch>
@alyssaq
alyssaq / pos.md
Last active February 13, 2024 07:57
English Parts of Speech

Nouns: Person, place, thing (Mary, mountains, building)
Pronouns: replaces nouns (his, her, I)
Verb: action (swim, eat)
Adjectives: descriptions (fantastic, gorgerous)
Adverb: change, modify, describe verbs (hastily, gracefully)
Prepositions: relationships. Condition, direction, location, time (behind, on, in spite of)
Conjunctions: joins.
Coordinating Conjunctions: (FANBOYS - Fan And Nor But Or Yet So)
Correlative Conjunctions: together with coordinating (either...or, not only...but also, both...and)
Adverbial Conjunctions: Joining adverbs, glues 2 complete thoughts, conclusions (HOT SHOT CAT - However, Otherwise, Therefore, Similarly, Hence, On the other hand, Thus, Consequently, Also, Then, nevertheless, in addition, consequently)

@alyssaq
alyssaq / soylent.md
Last active August 29, 2015 14:06
My soylent receipe with iherb ingredients and an egg
No. Ingredient Day Amount Meal 1 Meal 2 Meal 3
1 Multi-V 1 capsule 1 capsule - -
2 Potassium 3 tsp 1 tsp 1 tsp 1 tsp
3 Oat Flour 1 cup ½ cup ½ cup -
4 Oat Bran 3 tbsp 1 tbsp 1 tbsp 1 tbsp
5 Buckwheat flour 4 tbsp 1 tbsp 1 tbsp 2 tbsp
6 Lecithin Granules 3 tbsp 1 tbsp 1 tbsp 1 tbsp
7 Whey Protein1 2½ scoops 1 scoop 1 scoop ½ scoop
8 Chia Seeds 2 tbsp - 1 tbsp 1 tbsp
@alyssaq
alyssaq / createAndPopulate.js
Created August 30, 2014 06:05
Clear all and batch create documents with Mongoose
var plans = [ { plan: 1,
users: 3,
amount: 18,
name: 'Micro',
billingPeriod: 'Month' },
{ plan: 2,
users: 8,
amount: 40,
name: 'Mini',
billingPeriod: 'Month' },