This file contains 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
Validate = { | |
getDefaultProps: -> | |
validate: [] | |
hasErrors: -> | |
errors = [] | |
@validate.forEach (cond) => | |
if cond.test(@state.value) | |
errors.push(cond.message) |
This file contains 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 requests_oauthlib import OAuth1Session | |
from flask import Flask, request | |
from flask.json import jsonify | |
import os | |
app = Flask(__name__) | |
# Get the access token from the environment variables | |
api_key = os.environ.get('BEATPORT_API_KEY', None) | |
api_key_secret = os.environ.get('BEATPORT_API_KEY_SECRET', None) |
This file contains 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 requests_oauthlib import OAuth1Session | |
from flask import Flask, request, redirect, session, url_for, current_app | |
from flask.json import jsonify | |
import os | |
import urllib | |
app = Flask(__name__) | |
# This information is obtained upon registration of a new Bp | |
client_id='<key>' |
This file contains 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
(defn computer-down? [{{computer-y :y} :computer | |
{ball-y :y} :ball player-height :player-height :as state}] | |
(and (> (- computer-y 20) ball-y) (>= (- computer-y (/ player-height 2)) 0))) | |
;; vs. | |
(defn computer-down? [{:keys [ball computer] :as st}] | |
(let [cy (:y computer)] | |
(and (> (- cy 20) (:y ball)) | |
(>= (- cy (/ (:player-height st) 2)) 0)))) |
This file contains 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 Little JavaScripter | |
// http://www.crockford.com/javascript/little.js | |
// Copyright 2003 Douglas Crockford. All rights reserved wrrrld wide. | |
// May 4, 2011 | |
// Produce a printable presentation of an s-expression | |
function p(x) { |
This file contains 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
class bBox | |
bboxstr: "-74.0045051,40.7558605,-73.994675,40.7627951" | |
zoom: 18 | |
getTiles: (bboxstr, zoom) -> | |
bboxarr = bboxstring.split "," | |
if (bboxarr.length != 4) | |
true | |
bbox = new L.latLngBounds new L.latLng(bboxarr[1], bboxarr[0]) , new L.latLng(bboxarr[3], bboxarr[2]) | |
NW = bbox.getNorthWest() |
This file contains 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
#!/bin/bash | |
echo Removing moving modules from git repository and drupal database. | |
modules=( "signup" "recaptcha" "captcha" "spamicide" "badbehavior" "apc" "google_website_optimizer" "context" "date_context" "garland" "shrew" "taxonomy_manager" "customerror" "jquery_ui" "nypl_bibliocommons" ) | |
libraries=( "simplepie" "awssdk" ) | |
for module in "${modules[@]}" | |
do | |
drush dis $module -y | |
git rm --cached sites/all/modules/$module | |
git rm -r .git/modules/sites/all/modules/$module | |
rm -r sites/all/modules/$module |
This file contains 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
(ns lenskit-hello.core | |
(:require [clojure.java.io :as io]) | |
(:import [org.grouplens.lenskit | |
ItemRecommender ItemScorer Recommender RecommenderBuildException] | |
[org.grouplens.lenskit.baseline | |
BaselineScorer ItemMeanRatingItemScorer UserMeanBaseline | |
UserMeanItemScorer] | |
[org.grouplens.lenskit.core | |
LenskitConfiguration LenskitRecommender] | |
[org.grouplens.lenskit.cursors Cursors] |
This file contains 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
/** | |
* PHP would look something like this (it could be in a module or theme): | |
* The list of scripts could be set somewhere in Drupal's admin interface. | |
* | |
* <?php | |
* define(SCRIPTS, variable_get('external_scripts')); | |
* drupal_add_js(array('my_module' => SCRIPTS), 'setting'); | |
* ?> | |
*/ |
This file contains 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
options("repos"="http://cran.us.r-project.org") | |
library("rgdal") | |
myPolygons = readOGR("/path/to/file",layer="mylayer") | |
alpha=0.75 | |
library(alphahull) | |
pts = spsample(myPolygons, n=1000, type="regular") | |
x.as = ashape(coordinates(pts),alpha=alpha) | |
# need to convert x.as to a SpatialPolygon | |
# code to convert ahull into sp: |