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 AuthController { | |
SpringSecuritySigninService springSecuritySigninService | |
def signin = { | |
GrailsOAuthService service = resolveService(params.provider) | |
if (!service) { | |
redirect(url: '/') | |
} |
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
OAuthProfile getProfile(OAuthService authService, Token accessToken) { | |
OAuthRequest request = new OAuthRequest(Verb.GET, 'https://www.googleapis.com/oauth2/v1/userinfo') | |
authService.signRequest(accessToken, request) | |
def response = request.send() | |
def user = JSON.parse(response.body) | |
def login = "${user.given_name}.${user.family_name}".toLowerCase() | |
new OAuthProfile(username: login, email: user.email, uid: user.id, picture: user.picture) |
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 LinkStatistics { | |
static belongsTo = [link: Link] | |
Integer score | |
Date dateCreated | |
static mapping = { | |
table("v_link_statistics") | |
link(fetch: FetchMode.EAGER) | |
version(false) |
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 jinkubator.endpoint.api | |
(:require [compojure.api.sweet :refer :all] | |
[ring.util.http-response :refer [ok]] | |
[schema.core :as s])) | |
(s/defschema Message | |
{:message s/Str}) | |
(s/defschema MessageList | |
[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
import org.vertx.java.core.Handler; | |
import org.vertx.java.core.VoidHandler; | |
import org.vertx.java.core.eventbus.Message; | |
import org.vertx.java.platform.Verticle; | |
public class Sender extends Verticle { | |
public void start() { | |
send(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
use_bpm 130 | |
ch1 = [62,65,69] | |
ch2 = [63,67,70] | |
ch3 = [65,69,72] | |
ch4 = [67,70,74] | |
live_loop :saws do | |
use_synth :supersaw | |
with_synth_defaults sustain_level: 0.75, release: 1.25, cutoff: 130, amp: 1.5 do |
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
use_bpm 130 | |
samps = "path_to_breaks" ## download from http://www.junglebreaks.co.uk/breaks.html | |
ch1 = [61,68,78] | |
ch2 = [61,68,76] | |
ch3 = [64,71,76] | |
ch4 = [59,66,75] | |
ch5 = [59,66,76] | |
ch6 = [57,64,76] |
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 worldcup.matches | |
(:require | |
[clj-http.client :as http])) | |
(def api-root "https://worldcup.sfg.io") | |
(defn get-all-matches [] | |
(-> | |
(http/get (str api-root "/matches") {:as :json}) | |
:body)) |
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
(->> lst | |
(map op1) | |
(map op2) | |
(filter p1) | |
first) | |
lst.stream() | |
.map(op1) | |
.map(op2) | |
.filter(p1) |
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 goal? [e] | |
(let [type (:type_of_event e)] | |
(or (= "goal" type) | |
(= "goal-penalty" type) | |
(= "goal-own" type)))) |