This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// By Justin Zollars | |
// jz.io | |
let asset1 = AVURLAsset(URL:tempImage, options:nil) | |
let generator = AVAssetImageGenerator(asset: asset1) | |
let time = CMTimeMakeWithSeconds(0, 30) | |
let size = CGSizeMake(425,355) | |
generator.maximumSize = size | |
let imgRef = generator.copyCGImageAtTime(time, actualTime: nil, error: nil) | |
let thumb = UIImage(CGImage:imgRef) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def merge_sort(array) | |
return array if array.size <= 1 | |
left = merge_sort array[0, array.size / 2] | |
right = merge_sort array[array.size / 2, array.size] | |
merge(left, right) | |
end | |
def merge(left, right) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Pick a chapter, save it on your desktop as text.text http://flyingmoose.org/tolksarc/book/ | |
# 2. save this on your desktop: | |
# 3. open up terminal on OSX | |
# 4. cd Desktop | |
# 5. run with ruby: | |
# ruby jz.rb | |
class MarkovChain | |
def initialize(text) | |
@words = Hash.new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
warnValidations: function(value) { | |
this.setState({warnErrorTypes:[]}) | |
if (value["fact_interviews"] == "0") { | |
this.setWarnTypes(2) | |
} else if (Number(value["fact_interviews"]) >= 20) { | |
this.setWarnTypes(3) | |
} | |
console.log(this.state.warnErrorTypes) | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from flask import Flask, url_for, jsonify | |
app = Flask(__name__) | |
import nltk, re, timex, json, sys | |
@app.route('/') | |
def api_root(): | |
return 'Welcome' | |
@app.route('/articles') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The steps are: | |
# 1. Pick an element, called a pivot, from the array. | |
# 2. Reorder the array so that all elements with values less than the pivot come before the pivot, while all elements with # # values greater than the pivot come after it (equal values can go either way). After this partitioning, the pivot is in # its final position. This is called the partition operation. | |
# 3. Recursively apply the above steps to the sub-array of elements with smaller values and separately to the sub-array of # elements with greater values. | |
class Array | |
def quicksort | |
return [] if empty? | |
# 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from app import db | |
from marshmallow import Schema, fields | |
class PlantMaterial(db.Model): | |
id = db.Column(db.Integer, primary_key=True) | |
cultivar = db.Column(db.String(64), index=True, unique=False) | |
variety = db.Column(db.String(120), index=True, unique=False) | |
tissue = db.Column(db.String(64), index=True, unique=False) | |
form = db.Column(db.String(64), index=True, unique=False) | |
items = db.relationship('Inventory', backref='plant_material', lazy='dynamic') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import with_statement | |
from alembic import context | |
from sqlalchemy import engine_from_config, pool | |
from logging.config import fileConfig | |
import logging | |
# this is the Alembic Config object, which provides | |
# access to the values within the .ini file in use. | |
config = context.config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
STARTING DOCKER | |
https://docs.docker.com/machine/get-started/ | |
docker-machine ls | |
docker-machine create --driver virtualbox default | |
docker-machine env default | |
eval "$(docker-machine env default)” | |
docker-machine start default | |
docker-machine ip default |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import docker | |
from docker import Client | |
from docker.utils import kwargs_from_env | |
client = Client(version='1.20',**kwargs_from_env(assert_hostname=False)) | |
client.containers() | |
client.info() | |
client.version() | |
Starting a Container from an image |