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
Parse.Cloud.beforeSave(Parse.Role, function(request, response) { | |
Parse.Cloud.useMasterKey(); | |
var role = request.object; | |
if (user_js.isAdministratorRole(role)) { | |
if (role.isNew()) { | |
// Administrator role creation | |
// Set ACL on create | |
var administratorRoleACL = new Parse.ACL(); | |
administratorRoleACL.setPublicReadAccess(false); | |
administratorRoleACL.setPublicWriteAccess(false); |
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 | |
import random | |
# n = 50 | |
# d = 2 | |
# a = 25 | |
# cnt = 1000000 | |
# result = {} | |
# for _ in range (cnt): | |
# values = [random.randrange(d)+1 for _ in range(n)] | |
# v = sum(values) - a |
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
class Data(object): | |
def __init__(self, **kwargs): | |
self.t = None # | |
self.m = -1 # | |
self.dI = None # | |
self.dS = None # | |
self.dM = None # | |
self.dG = 0 # | |
initialize_model(self, **kwargs) |
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
/** | |
* Example function | |
*/ | |
Parse.Cloud.define("hello", function(request, response) { | |
response.success("Hello, CardGame Cloud Code!"); | |
}); | |
/** | |
* Draw a new booster pack gacha of MCards from an unlimited card pool. | |
* (which means, this is not a "box gacha") |
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
// | |
// ADMWaitingForLoginViewController.m | |
// CardGame | |
// | |
// Created by 小野 将司 on 2013/03/17. | |
// Copyright (c) 2013年 akisute. All rights reserved. | |
// | |
#import <Parse/Parse.h> | |
#import <Parse/PF_MBProgressHUD.h> |
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
- (void)signUpViewController:(PFSignUpViewController *)signUpController didFailToSignUpWithError:(NSError *)error | |
{ | |
DNSLogError(@"Error while signing up: %@", error); | |
UIAlertView *alertView = [[UIAlertView alloc] init]; | |
alertView.title = @"Error while sigining up"; | |
alertView.message = error.localizedDescription; | |
[alertView addButtonItem:[RIButtonItem itemWithLabel:@"OK" action:^{ | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
[self dismissViewControllerAnimated:YES completion:NULL]; | |
}); |
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
- (void)signUpViewController:(PFSignUpViewController *)signUpController didFailToSignUpWithError:(NSError *)error | |
{ | |
DNSLogError(@"Error while signing up: %@", error); | |
[[[UIAlertView alloc] initWithTitle:@"Error while sigining up" | |
message:error.localizedDescription | |
cancelButtonItem:[RIButtonItem itemWithLabel:@"OK" action:^{ | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
[self dismissViewControllerAnimated:YES completion:NULL]; | |
}); | |
}] |
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
- (void)succeed1 | |
{ | |
SLComposeViewController *vc = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; | |
[vc addURL:[NSURL URLWithString:@"http://akisute.com"]]; | |
[self.navigationController presentViewController:vc animated:YES completion:nil]; // posts with a link, no error | |
} | |
- (void)succeed2 | |
{ | |
SLComposeViewController *vc = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; |
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 ruby | |
require 'rubygems' | |
require 'xcodeproj' | |
require 'pathname' | |
require 'fileutils' | |
# | |
# Define utility functions | |
# | |
def add_system_frameworks_to_project(proj, framework_names, option=:required) |
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
[super viewWillAppear:animated]; | |
NSManagedObjectContext *context = [NSManagedObjectContext MR_contextForCurrentThread]; | |
// ここで、FEUnitはFEClanに対してclanというrelationを持っているとする | |
// FEClanはFEUnitに対してunitsというrelationを持っているとする | |
// NSManagedObjectIDで検索 | |
// Property clanID must be permanent since a temporary ID cannot handle this query | |
self.fetchedResultsController = [FEUnit MR_fetchAllGroupedBy:nil | |
withPredicate:[NSPredicate predicateWithFormat:@"clan == %@", self.clanID] |