Skip to content

Instantly share code, notes, and snippets.

View flamesoft's full-sized avatar

Yan Zhang flamesoft

View GitHub Profile
@omarmiatello
omarmiatello / EasyWS.kt
Last active May 6, 2024 12:08
First experiment with WebSocket and Kotlin Coroutine
import kotlinx.coroutines.experimental.CommonPool
import kotlinx.coroutines.experimental.channels.Channel
import kotlinx.coroutines.experimental.launch
import okhttp3.*
import okio.ByteString
import kotlin.coroutines.experimental.suspendCoroutine
/**
* Created by omarmiatello on 17/06/17.
*/
@hassy
hassy / parse_aws.md
Last active January 17, 2024 04:11
Deploying Parse Server on AWS (WIP)

Deploying Parse Server on AWS

Note: this is a work-in-progress and will be updated with more information over the next few days.

Intro

This guide will walk you through deploying your own instance of the open-source Parse Server. This would be a good starting point for testing your existing application to see if the functionality provided by the server is enough for your application, and to potentially plan your migration off the Parse Platform.

This guide will walk you through using Elastic Beanstalk (EB), which is an AWS service similar to Heroku. Why use EB rather than Heroku? Elastic Beanstalk does not lock you into Heroku-specific ways of doing things, is likely cheaper to run your backend on than Heroku, and it integrates with other services that AWS offer (and they offer almost everything one needs to run an application these days).

@antslava
antslava / FixedCheckedTextView.java
Last active May 13, 2016 05:22
CheckedTextView doesn't save checked state after rotation. Below you can find solution.
/**
* Fix issue with checked state.
*
* Created by Antonenko Viacheslav on 16/11/15.
*/
public class FixedCheckedTextView extends AppCompatCheckedTextView {
public FixedCheckedTextView(Context context) {
super(context);
}
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
CREATE SCHEMA IF NOT EXISTS `survey_001_models_from_tables` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
USE `survey_001_models_from_tables` ;
-- -----------------------------------------------------
-- Table `survey_001_models_from_tables`.`organizations`
-- -----------------------------------------------------
@pulkitsinghal
pulkitsinghal / sample.js
Created May 3, 2014 00:27
Parse Cloud Code for checking if a user has the required role
Parse.Cloud.define('isAdmin', function(request, response){
if(!Parse.User.current()){
response.error('Request did not have an authenticated user attached with it');
}
else {
userHasRole(request.params.parseSessionToken, 'super') // ex: check if user has "super" role
.then(function(hasRole){
if(hasRole){
response.success({super: true});
}else{
@frankiesardo
frankiesardo / CustomMatchers.java
Created November 15, 2013 19:20
Espresso & Brioche
public class CustomMatchers {
public static Matcher<View> withBackground(final int resourceId) {
return new TypeSafeMatcher<View>() {
@Override
public boolean matchesSafely(View view) {
return sameBitmap(view.getContext(), view.getBackground(), resourceId);
}
@Override