Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am cmcewen on github.
  • I am cmcewen (https://keybase.io/cmcewen) on keybase.
  • I have a public key ASA1L4Bq0azHVJrs_0JPivyzYvNlU_C8rBWFxDa5W5YGlAo

To claim this, I am signing this object:

➜ web3j-cli git:(master) java -version
java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)
➜ web3j-cli git:(master) ./gradlew build
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :compileJava
/Users/cmcewen/celo/web3j-cli/src/main/java/org/web3j/console/project/ProjectCreator.java:59: warning: [deprecation] <R>run(R,String...) in CommandLine has been deprecated
@cmcewen
cmcewen / castFlow.js
Last active October 6, 2016 12:22
Casting flow types
type QuestionType = {
answers: string;
};
type PostType = {
comments: string;
};
type ActivityItemType = {
type: 'question' | 'post';
06-16 22:05:49.813 22411-22411/? E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NullPointerException: Argument 'context' cannot be null
at com.facebook.internal.Validate.notNull(Validate.java:76)
at com.facebook.internal.Utility.getMetadataApplicationId(Utility.java:594)
at com.facebook.appevents.AppEventsLogger.<init>(AppEventsLogger.java:757)
at com.facebook.appevents.AppEventsLogger.<init>(AppEventsLogger.java:732)
at com.facebook.appevents.AppEventsLogger.newLogger(AppEventsLogger.java:400)
at com.facebook.reactnative.androidsdk.FBAppEventsLoggerModule.initialize(FBAppEventsLoggerModule.java:117)
@cmcewen
cmcewen / index.ios.js
Last active March 19, 2017 20:51
Loading animation
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
Animated,
AppRegistry,
➜ universal-redux-starter git:(master) npm run dev
> universal-redux-starter@0.0.1 dev /Users/cmcewen/Code/universal-redux-starter
> concurrent --kill-others "npm run watch-client" "npm run dev-server"
[1]
[1] > universal-redux-starter@0.0.1 dev-server /Users/cmcewen/Code/universal-redux-starter
[1] > NODE_PATH=./src universal-redux-server
[1]
[0]
#!/usr/bin/env node
const express = require('../lib/server.js').default;
const renderer = require('../lib/server/renderer').default;
const start = require('../lib/start').default;
const userConfig = require('./user-config');
const path = require('path');
const root = path.resolve(__dirname, '../../..');
const sourceDir = path.resolve(root, './src');
#!/usr/bin/env node
const Express = require('express');
const webpack = require('webpack');
const userConfig = require('./user-config');
const path = require('path');
const root = path.resolve(__dirname, '../../..');
const sourceDir = path.resolve(root, './src');
const config = require('./merge-configs')(userConfig(root, sourceDir));
@cmcewen
cmcewen / upload.js
Created December 29, 2015 15:38
Upload image from React Native to Cloudinary
var CryptoJS = require('crypto-js');
function uploadImage(uri) {
let timestamp = (Date.now() / 1000 | 0).toString();
let api_key = 'your api key'
let api_secret = 'your api secret'
let cloud = 'your cloud name'
let hash_string = 'timestamp=' + timestamp + api_secret
let signature = CryptoJS.SHA1(hash_string).toString();
let upload_url = 'https://api.cloudinary.com/v1_1/' + cloud + '/image/upload'
@cmcewen
cmcewen / group_stories.py
Created January 31, 2015 20:57
Snapchat group stories hack
#!/usr/bin/env python
#using the awesome pysnap library: https://github.com/martinp/pysnap
from __future__ import print_function
import os.path
import sys
from getpass import getpass
from zipfile import is_zipfile, ZipFile