Skip to content

Instantly share code, notes, and snippets.

View auggernaut's full-sized avatar

Augustin Bralley auggernaut

View GitHub Profile
[
{
"name": "Give someone a compliment.",
"duration": "5",
"frequency": "Daily",
"image": "pexels-photo-134074.jpeg"
},
{
"name": "Do a quick high intensity workout.",
"duration": "5",
@auggernaut
auggernaut / PlayStore.coffee
Created July 17, 2014 22:05
update Card class in parse
console.log "card: " + cardId + " choice: " + choiceId
cardQuery = new Parse.Query 'Card'
cardQuery.equalTo 'objectId', cardId
cardQuery.first
success: (card) =>
card.addUnique 'hasPlayed', user.id
card.save()
@auggernaut
auggernaut / PlayStore.coffee
Created July 17, 2014 22:04
update pref table in parse.
# UPDATE Pref table to include current user in peggedBy array
console.log "peggee: #{peggeeId} card: #{cardId} choice: #{choiceId} "
card = new Parse.Object 'Card'
card.set 'id', cardId
peggee = new Parse.Object 'User'
peggee.set 'id', peggeeId
prefQuery = new Parse.Query 'Pref'
prefQuery.equalTo 'card', card
prefQuery.equalTo 'user', peggee
prefQuery.first
@state.halt()
@currentSide ?= 0
if side is 0 or side is 1
@currentSide = side
else
@currentSide = if @currentSide is 1 then 0 else 1
@auggernaut
auggernaut / PlayView.coffee
Created July 9, 2014 04:52
Scrollview, scroll on z axis
# TODO: make cards scroll on z axis
#@cards.outputFrom (offset) ->
# Transform.multiply(
# Transform.translate offset/100, offset/100, 50
# Transform.rotateY(1)
# )
@auggernaut
auggernaut / PlayStore.coffee
Created June 25, 2014 04:02
nested query to Parse from client
fetchCards: () ->
# Gets 10 random cards from Card class
Choice = Parse.Object.extend 'Choice'
Card = Parse.Object.extend 'Card'
cardQuery = new Parse.Query Card
cardQuery.limit 10
cardQuery.find
success: (cards) =>
choiceQuery = new Parse.Query Choice
done = 0
@auggernaut
auggernaut / cosmos.js
Created September 15, 2013 19:21
CouchDB cookie auth from client.
var params = "name=augman&password=hello";
$.post(this.host + "/db/_session", params, function (res) {
if (JSON.parse(res).ok) {
cb(null, {message: "register success", details: res});
} else {
cb({message: "register failure", details: res}, null);
}
});
@auggernaut
auggernaut / login.js
Created September 10, 2013 22:36
GratziCosmos old register methods
var creds = { "user": $("#username").val(), "email": $("#email").val(), "pass": $("#reg-password").val() };
var user;
var appname = Gratzi.Config.appName;
Gratzi.register(creds, function (err, res) {
if (res) {
console.log(res);
user = res.details;
@auggernaut
auggernaut / login.js
Created September 10, 2013 22:35
GratziCosmos old login methods
var creds = { "user": $("#login-email").val(), "pass": $("#signin-password").val() };
var star;
var appname = Gratzi.Config.appName;
Gratzi.login(creds, function (err, res) {
if (res) {
console.log(res);
star = res.details.star;
Cosmos.login(creds, star, appname, function (err, res) {
@auggernaut
auggernaut / LoginView.html
Created September 10, 2013 22:16
Login, Register, or FBConnect view
<div id="loginRegister">
<div id="login">
<h1>Login</h1>
<input type="text" value="" name="email" class="input-block-level" id="login-email"
placeholder="email" required>
<input type="password" value="" name="password" class="input-block-level" id="signin-password"
placeholder="password" required>