Skip to content

Instantly share code, notes, and snippets.

View lexer's full-sized avatar
🦀

Aleksei Zakharov lexer

🦀
View GitHub Profile
@lexer
lexer / Using mongo shell
Created December 29, 2011 08:49
How to remove deprecated fields in mongo?
db.collection.find().forEach(function(x) {
delete x.badField;
db.collection.save(x);
})
@lexer
lexer / gist:1564029
Created January 5, 2012 06:36
WARNING: UNPROTECTED PRIVATE KEY FILE!
sudo chmod 600 ~/.ssh/id_rsa
sudo chmod 600 ~/.ssh/id_rsa.pub
sudo chmod 644 ~/.ssh/known_hosts
sudo chmod 755 ~/.ssh
@lexer
lexer / gist:1564113
Created January 5, 2012 07:22
Android bash profile
export ANDROID_HOME=$HOME/android-sdk
export PATH=${PATH}:android-sdk/tools:android-sdk/platform-tools
@lexer
lexer / gist:1564176
Created January 5, 2012 07:55
Android maven settings.xml
<settings>
<profiles>
<profile>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<sign.keystore>${user.home}/keystore/KEYSTORE.keystore</sign.keystore>
<sign.alias>ALIAS</sign.alias>
<sign.keypass>KEYPASS</sign.keypass>
var zimride = require('./zimride');
var pointA = {lat: 55.157199, lng: 61.364264};
var pointB = {lat: 55.15791, lng: 61.38864};
var pointC = {lat: 55.153472, lng: 61.364779};
var pointD = {lat: 55.153864, lng: 61.381688};
console.log(zimride.getMinDetourDistance(pointA, pointB, pointC, pointD));
@lexer
lexer / OkHttpRequest
Created May 29, 2013 11:35
Google Http Client Library OkHttp Transport
/*
* Copyright (c) 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
@lexer
lexer / gist:9125400
Created February 20, 2014 23:18
Reduce image size when picasso fail with OutOfMemmory
private Bitmap safeLoadBitmap(File file, int width, int height) throws IOException {
RequestCreator picassoRequestBuilder = picasso.load(file)
.resize(width, height)
.centerInside();
if (getTransformation() != null) {
picassoRequestBuilder.transform(getTransformation());
}
Bitmap bitmap = null;
@lexer
lexer / Headers
Last active August 29, 2015 14:10
User -> credits - > "0" cause JSON parse exception during POST /user on phone login
POST /users HTTP/1.1
Accept-Language en_US
Accept application/vnd.lyft.app+json;version=21
User-Agent lyft:android:5.0:2.8.0.1717
User-Device LGE Nexus 5
X-Carrier AT&T
X-Session eyJhIjoiN2E2NzIwYTgzYzcxYzBkZiIsImYiOiIxNTBlNDNmOS00M2NkLTRjOTItYjI1Mi02NzNhMTU3NGI4NDEiLCJnIjoiMjc1NTYwMjU5MjA1NzY3In0=
Content-Type application/json; charset=utf-8
Content-Length 126
Host api.lyft.com
@lexer
lexer / gist:b23a9e3959d732dfe23e
Created February 20, 2015 00:54
Add wallet card
public class AddWalletActivity extends Activity {
private static final String TAG = "AddWalletActivity";
private static final int REQUEST_CODE_MASKED_WALLET = 1;
private WalletFragment mWalletFragment;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.add_wallet);
Non-fatal Exception: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
at android.os.Handler.<init>(Handler.java:200)
at android.os.Handler.<init>(Handler.java:114)
at com.instabug.library.invoker.b.<init>(ShakeProcessor.java:35)
at com.instabug.library.internal.module.a.a(InstabugSDKComponent.java:59)
at com.instabug.library.i.b(InstabugDelegate.java:130)
at com.instabug.library.i.<init>(InstabugDelegate.java:99)
at com.instabug.library.Instabug$Builder.build(Instabug.java:894)
at com.instabug.library.Instabug$Builder.build(Instabug.java:968)