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
contract Donation { | |
mapping (address => uint) user_amounts; | |
/* DOES THIS METHODS MODIFY user_amounts of the Relay contract ??? */ | |
function sendDonation(uint n) { | |
user_amounts[msg.sender] = user_amounts[msg.sender] + n | |
} | |
} |
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
# check if a string a valid by having opening and closed brackets/parenthesis | |
def is_valid_string(str) | |
arr = [] | |
str.each_char do |c| | |
arr.push(c) if c == '{' or c == '[' or c == '(' | |
if c == '}' | |
# check last element of array - must correspond to '{'' | |
if not arr.empty? and arr[-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
java.lang.RuntimeException: retrofit.converter.ConversionException: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $ | |
at com.Challfie.android.challfiefragment.AddChallfieFinalActivity$7.failure(AddChallfieFinalActivity.java:415) | |
at retrofit.CallbackRunnable$2.run(CallbackRunnable.java:53) | |
at android.os.Handler.handleCallback(Handler.java:739) | |
at android.os.Handler.dispatchMessage(Handler.java:95) | |
at android.os.Looper.loop(Looper.java:135) | |
at android.app.ActivityThread.main(ActivityThread.java:5424) | |
at java.lang.reflect.Method.invoke(Native Method) | |
at java.lang.reflect.Method.invoke(Method.java:372) | |
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:913) |
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
// CAPSPageMenu.swift | |
// | |
// Niklas Fahl | |
// | |
// Copyright (c) 2014 The Board of Trustees of The University of Alabama All rights reserved. | |
// | |
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | |
// | |
// Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | |
// |
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 MatchupsVC: UIViewController { | |
var pageMenu : CAPSPageMenu? | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Hide on swipe & keboard Appears | |
self.navigationController?.hidesBarsOnSwipe = false | |
self.navigationController?.navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: UIBarButtonItemStyle.Plain, target: nil, action: nil) | |
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
{ | |
"matchups" : [ | |
{ | |
"challenges" : [ | |
{ | |
"difficulty" : 1, | |
"id" : 168, | |
"complete_status" : 2, | |
"description" : "Prendre un selfie avec tes collègues ou camarades de classe" | |
} |
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
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.challfie.android/com.Challfie.android.challfiefragment.AddChallfieTakePictureActivity}: java.lang.RuntimeException: Fail to connect to camera service | |
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2305) | |
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2365) | |
at android.app.ActivityThread.access$800(ActivityThread.java:148) | |
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283) | |
at android.os.Handler.dispatchMessage(Handler.java:102) | |
at android.os.Looper.loop(Looper.java:135) | |
at android.app.ActivityThread.main(ActivityThread.java:5272) | |
at java.lang.reflect.Method.invoke(Native Method) | |
at java.lang.reflect.Method.invoke(Method.java:372) |
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
public static Bitmap decodeSampledBitmapFromResource(Resources res, int resId, | |
int reqWidth) { | |
// First decode with inJustDecodeBounds=true to check dimensions | |
final BitmapFactory.Options options = new BitmapFactory.Options(); | |
options.inJustDecodeBounds = true; | |
BitmapFactory.decodeResource(res, resId, options); | |
// Calculate inSampleSize | |
options.inSampleSize = calculateInSampleSize(options, reqWidth); |
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
Bitmap myBitmap = BitmapFactory.decodeFile(picturePath); | |
Bitmap resized = Bitmap.createScaledBitmap(myBitmap, myBitmap.getWidth() / 2, myBitmap.getHeight() / 2, true); // TO AVOID OUT OF MEMORY FOR HIGH RESOLUTION PICTURE | |
rotated_photo = rotateBitmap(resized) | |
public static Bitmap rotateBitmap(Bitmap bitmap) { | |
ExifInterface exif = null; | |
try { | |
exif = new ExifInterface(bitmap); | |
} catch (IOException e) { |
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
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { | |
// Override point for customization after application launch. | |
self.window = UIWindow(frame: UIScreen.mainScreen().bounds) | |
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil) | |
var loginViewController:LoginVC = mainStoryboard.instantiateViewControllerWithIdentifier("loginVC") as! LoginVC | |
var timelineViewController:TimelineVC = mainStoryboard.instantiateViewControllerWithIdentifier("timeline") as! TimelineVC | |
let login = KeychainInfo.login | |
let auth_token = KeychainInfo.auth_token |