Skip to content

Instantly share code, notes, and snippets.

View troZee's full-sized avatar

troZee

View GitHub Profile
@influx6
influx6 / nativemocks.js
Created August 8, 2019 02:28
Native Mocks for Jest
import 'react-native'
export const MockNativeEventEmitter = () => {
return () => {
const EventEmitter = require('EventEmitter')
const RCTDeviceEventEmitter = require('RCTDeviceEventEmitter')
/**
* Mock the NativeEventEmitter as a normal JS EventEmitter.
*/
@dreikanter
dreikanter / encrypt_openssl.md
Last active May 2, 2024 12:55 — forked from crazybyte/encrypt_openssl.txt
File encryption using OpenSSL

Symmetic encryption

For symmetic encryption, you can use the following:

To encrypt:

openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt

To decrypt:

@ashfurrow
ashfurrow / Fresh macOS Setup.md
Last active May 3, 2024 01:51
All the stuff I do on a fresh macOS Installation

Apps to install from macOS App Store:

  • Pastebot
  • GIF Brewery
  • Slack
  • Keynote/Pages/Numbers
  • 1Password
  • OmniFocus 3
  • Airmail 3
  • iA Writer
@segunfamisa
segunfamisa / app-module-build.gradle
Last active June 22, 2020 11:43
Using gradle extra properties to manage Android dependency versioning
// app module build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
applicationId "com.segunfamisa.gradleextraproperties"
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
@oguzbabaoglu
oguzbabaoglu / CustomJUnitRunner.java
Created February 10, 2016 23:09
Custom AndroidJUnitRunner with wake lock
import static android.view.WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD;
import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
import static android.view.WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON;
public class CustomJUnitRunner extends AndroidJUnitRunner {
@Override public void onCreate(Bundle arguments) {
super.onCreate(arguments);
ActivityLifecycleMonitorRegistry.getInstance().addLifecycleCallback(new ActivityLifecycleCallback() {
package productmeister.com.productmeister.view;
import android.annotation.TargetApi;
import android.os.Build;
import android.support.design.widget.AppBarLayout;
import android.support.v4.view.ViewCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="your.package.name" >
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:allowBackup="true"
@mlzxy
mlzxy / PlatformDetectAndRedirect.js
Last active October 20, 2016 19:27
Detect platform and redirect for app downloading or app custom schema url
(function() {
var TIMEOUT = 300;
var platform = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
@marcelpinto
marcelpinto / ControllableAppBarLayout.java
Last active December 12, 2019 03:42 — forked from blipinsk/ControllableAppBarLayout.java
An extension of Android AppBarLayout, that allows to programatically change the CollapsibleToolbarLayout state and receive state changes (collapsed, expanded and idle)
package com.eatfirst.android.ui.custom;
/**
* Copyright 2015 Bartosz Lipinski
*
* 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
@iPaulPro
iPaulPro / include_list_viewpager.xml
Last active March 7, 2024 11:13
CollapsingToolbarLayout with TabLayout
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (C) 2015 The Android Open Source Project
~
~ 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