Skip to content

Instantly share code, notes, and snippets.

View AndreasMattsson's full-sized avatar

Andreas Mattsson AndreasMattsson

View GitHub Profile
@adalinesimonian
adalinesimonian / block-the-blue.md
Last active February 21, 2024 22:56
Block all verified Twitter accounts on screen
@chibatching
chibatching / FlowThrottleDebounce.kt
Last active May 9, 2024 08:28
Throttle and Debounce on Flow Kotlin Coroutines
fun <T> Flow<T>.throttle(waitMillis: Int) = flow {
coroutineScope {
val context = coroutineContext
var nextMillis = 0L
var delayPost: Deferred<Unit>? = null
collect {
val current = SystemClock.uptimeMillis()
if (nextMillis < current) {
nextMillis = current + waitMillis
@afshin-hoseini
afshin-hoseini / Swizzeling main bundle.swift
Created November 20, 2017 07:12
Forcing change localization for first iOS application run
//First, define a custom bundle class as like as below
import Foundation
//A key used for exchanging associated object
var _BUNDLE_KEY = 0
class BundleEx : Bundle {
override func localizedString(forKey key: String, value: String?, table tableName: String?) -> String {
@yangweigbh
yangweigbh / SkipList.kt
Created July 14, 2017 10:07
SkipList Implemented in Kotlin
import java.util.*
/**
* Created by yangwei-ms on 2017/7/14.
*/
class SkipList<T>(private val comparator: Comparator<T>) {
private var curHeight: Int = 1
private val head: Node<T> = Node(null, MAX_HEIGHT)
private val rnd: Random = Random(System.currentTimeMillis())
@emrul
emrul / Example.kt
Last active February 8, 2018 19:08
Hack to get Jsoniter to recognise JSONProperty annotations on Kotlin data classes
data class User(@JsonProperty("userName") val name: String)
val userObj = User("John")
JsoniterKotlinSupport.enable()
JsoniterAnnotationSupport.enable()
val jsonUserString = JsonStream.serialize(userObj)
// jsonUserString will contain: {"userName":"John"}
@mefarazath
mefarazath / GagSsl.java
Last active June 1, 2022 16:07 — forked from chalup/GagSsl.java
Get OkHttpClient which ignores all SSL errors.
private static OkHttpClient getUnsafeOkHttpClient() {
try {
// Create a trust manager that does not validate certificate chains
final TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
@Override
public void checkClientTrusted(java.security.cert.X509Certificate[] chain,
String authType) throws CertificateException {
}
@amullins83
amullins83 / README.md
Last active March 29, 2024 15:04
A simple command-line progress bar in C

#Progress in C

This is in an example meant to present some ideas regarding command-line progress bars in C.

##Important parts

The main idea is to overwrite stdout with new information every time a particular step is reached. I accomplished this using the VT100 emulator hack from [this Stack Overflow answer][1]. In a nutshell, printing ^[[2K to stdout erases the current line, but it doesn't necessarily move the cursor to the start. Printing \r does that. Also, I decided I wanted to print a newline character after the progress indicator, but I need to get rid of that newline on the next print. That's what \b does: it inserts a backspace, deleting the last character printed.

Also important is the call to fflush, which will guarantee that the print operation completes and is visible before the program moves on to its next task (see [this Stack Overflow answer][2]).

@application2000
application2000 / how-to-install-latest-gcc-on-ubuntu-lts.txt
Last active May 23, 2024 07:53
How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04)
These commands are based on a askubuntu answer http://askubuntu.com/a/581497
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
ABSOLUTELY NO WARRANTY.
If you are still reading let's carry on with the code.
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
@jgilfelt
jgilfelt / CurlLoggingInterceptor.java
Created January 9, 2016 15:34
An OkHttp interceptor that logs requests as curl shell commands
/*
* Copyright (C) 2016 Jeff Gilfelt.
*
* 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

First of all, this is not my brilliant effort to get react-native working on Windows, it is the collation of work by others, particularly @mqli and @Bernd Wessels. I've just summarised what worked for me.

If you would prefer to read what I've plagerised, head over to mqli's great gist

Disclaimer

  • The below is tested with react-native-cli 0.1.5, react-native 0.12.0 on Windows 10, node 4.1.1, and Android (physical Nexus 6 and AVD with API v22)
  • I hope this will all be redundant in a few weeks. Please comment on stuff that is now fixed and I will update this to keep it relevant.
  • Sprinkle a bit of YMMV around

Keep this github issue handy, it’s the bucket for all Windows/Linux related tricks to get RN working.