Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View shercoder's full-sized avatar

Pardeep Singh Sanghera shercoder

View GitHub Profile
@shercoder
shercoder / MacLocalServer.md
Created February 15, 2017 18:32
Configure Local Web Server Mac
  • Open Terminal
  • run sudo apachectl start
  • run localhost in your browser and it should be good
  • If you need to make changes to index.html, then go to /Library/WebServer/Documents/ and edit index.html.en
  • If you need to further configure Apache server then sudo vim /etc/apache2/httpd.conf and then sudo apachectl restart
@shercoder
shercoder / DrawableHelper.java
Created January 7, 2017 20:08
Got this drawable helper from Filibe Bezerra. Pretty cool.
import android.content.Context;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.view.MenuItem;

###Note Apple will reject apps that are using private url schemes (Ugh, Apple....) if they are pretty much obvius. Some apps are rejected and others are not, so, be aware of this issue before implementing any of those URL's in your app as a feature.

[UPDATE : Not yet tested in iOS 10. It will fail because of policies changes in URL scheme handling.]

[UPDATE 2:The openURL() method of UIApplication is now deprecated. You should use application(_:open:options:) instead]

##[UPDATE 3: For now you just can use url schemes to open your apps's settings with Swift 3.0 (Xcode 8). I'll keep you informed when OS preferences can be reached]

"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"rc-start": "npm start -- --reset-cache",
"clean": "rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean",
"clean-start": "npm run clean && npm run rc-start",
"fresh-install": "rm -rf $TMPDIR/react-* && watchman watch-del-all && rm -rf ios/build/ModuleCache/* && rm -rf node_modules/ && npm cache clean && npm install",
"fresh-start" : "npm run fresh-install && npm run rc-start",
"tron": "node_modules/.bin/reactotron"
}
@shercoder
shercoder / .gitconfig
Last active August 10, 2016 19:14
Wanderful Gitconfig
[alias]
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
lr = log --pretty=format:"%Creset%s%Cblue\\ [%cn]" --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
lnc = log --pretty=format:"%h\\ %s\\ [%cn]"
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
le = log --oneline --decorate
dag = log --graph --oneline --decorate --all
brdiff = log --graph --pretty=format:"%Cred%h%Creset\\ -%C(yellow)%d%Creset\\ %s\\ %Cgreen(%cr)%Creset\\" --abbrev-commit --date=relative
@shercoder
shercoder / reactviewmemoryleak.txt
Created March 4, 2016 19:46
ReactView leaking context
03-04 11:21:58.523 10153-12159/com.mypackage.myapp D/LeakCanary: In com.mypackage.myapp:1.9.2:41.
03-04 11:21:58.524 10153-12159/com.mypackage.myapp D/LeakCanary: * com.mypackage.myapp.activities.MyReactActivity has leaked:
03-04 11:21:58.524 10153-12159/com.mypackage.myapp D/LeakCanary: * GC ROOT org.chromium.base.SystemMessageHandler.mLooper
03-04 11:21:58.524 10153-12159/com.mypackage.myapp D/LeakCanary: * references android.os.Looper.mThread
03-04 11:21:58.524 10153-12159/com.mypackage.myapp D/LeakCanary: * references thread java.lang.Thread.localValues (named 'main')
03-04 11:21:58.524 10153-12159/com.mypackage.myapp D/LeakCanary: * references java.lang.ThreadLocal$Values.table
03-04 11:21:58.524 10153-12159/com.mypackage.myapp D/LeakCanary: * references array java.lang.Object[].[71]
03-04 11:21:58.524 10153-12159/com.mypackage.myapp D/LeakCanary: * references com.facebook.react.bridge.queue.MessageQueueThreadImpl.mHandler
03-04 11:21:58.524 10153-12159/com.mypackage.myapp D/LeakCanary: * references com.
@shercoder
shercoder / gist:5992823
Last active December 19, 2015 17:38
Linux Commands

##Create public keys

  • Generate a public key
ssh-keygen -t dsa
  • Now put public key to your remote server
scp .ssh/id_dsa.pub singh@server.com:
  • Install public key on remote server
@shercoder
shercoder / gist:5906915
Last active December 19, 2015 05:49
Cool linux stuff
  • Termination status of the last executed program available via a shell variable named $?
@shercoder
shercoder / gist:5647795
Last active December 17, 2015 17:39
Bash Aliases that I think are useful
# I just installed SanDisk 6Gig/s SSD in my Sony VAIO Laptop today.
# I also installed Xubuntu 13.04 on it as well. I have been
# using Ubuntu from almost a year now. I was actually kind of
# getting tired of Ubuntu, it was causing a lot of issues. And yes I
# am well aware of the fact that Xubuntu is technically Ubuntu.
# Anyways that's not why I am writing this gist. I am just creating
# this gist so I can have a reference to my bash aliases file
# and so that other's can use it as an example as well.
@shercoder
shercoder / themes-debug.xml
Last active September 2, 2015 17:10 — forked from dlew/themes-debug.xml
With the new theming in AppCompat, a lot of assets are tinted automatically for you via theme attributes. That has often led me to wonder "where the hell did this color come from?" You can replace your normal theme with this debug theme to help figure out the source of that color.
<!-- You can change the parent around to whatever you normally use -->
<style name="DebugColors" parent="Theme.AppCompat">
<!-- System colors -->
<item name="android:windowBackground">@color/__debugWindowBackground</item>
<item name="android:colorPressedHighlight">#FF4400</item>
<item name="android:colorLongPressedHighlight">#FF0044</item>
<item name="android:colorFocusedHighlight">#44FF00</item>
<item name="android:colorActivatedHighlight">#00FF44</item>