Skip to content

Instantly share code, notes, and snippets.

View Aaronphy's full-sized avatar
🏀
Focusing

Aaronphy Aaronphy

🏀
Focusing
View GitHub Profile
@maximilian-lindsey
maximilian-lindsey / express_in_electron.md
Last active November 3, 2024 21:30
How to run Express inside an Electron app

How to run Express inside an Electron app

You can run your Express app very easily inside your Electron app.

All you need to do is to:

  • place all the files of your Express app inside a new app folder in your_electron_app\resources\app
  • reconfigure the app.js file
  • refactor some relative pathes in your Express app
@girvo
girvo / BackgroundTask.h
Created March 2, 2016 06:38 — forked from liamzebedee/BackgroundTask.h
Attempts at implementing background tasks in React Native iOS
//
// BackgroundTask.h
// tomtrack
//
// Created by Liam Edwards-Playne on 13/02/2016.
//
#import "RCTBridgeModule.h"
@interface BackgroundTask : NSObject <RCTBridgeModule>
@thekarel
thekarel / cookie.swift
Created March 4, 2016 11:43
Grab an HTTP cookie value in Swift on iOS
@leviyehonatan
leviyehonatan / PersistentCookieStore.kt
Last active June 1, 2024 17:20
This is a kotlin implementation of a persistent cookie store for android, using SharedPreferences and Gson for the actual persistence
internal class PersistentCookieStore(val context: Context) : CookieStore {
inner class DatedCookie(val cookie: HttpCookie, val creationDate: Date)
val SP_COOKIE_STORE = "cookieStore"
val SP_KEY_DELIMITER = "|"
val SP_KEY_DELIMITER_REGEX = "\\" + SP_KEY_DELIMITER
val cookieSharedPreferences = context.getSharedPreferences(SP_COOKIE_STORE, Context.MODE_PRIVATE)
@nosix
nosix / Capture.kt
Created September 18, 2016 08:40
Taking a snapshot of the screen for Android (SDK 21) in Kotlin 1.0.3
package xxx
import android.content.Context
import android.graphics.Bitmap
import android.graphics.PixelFormat
import android.hardware.display.DisplayManager
import android.hardware.display.VirtualDisplay
import android.media.ImageReader
import android.media.projection.MediaProjection
import android.util.Log
@pgherveou
pgherveou / yield-to-async.js
Created October 5, 2016 16:12
convert co/yield to to async/await
// http://astexplorer.net/#/BICnPGGYdU/4
export default function ({types: t}) {
return {
visitor: {
FunctionDeclaration(path) {
if (path.node.generator) {
path.node.async = true
path.node.generator = false
}
@jesty
jesty / OtherActivity.java
Last active July 6, 2023 06:36
Share cookies between WebView and OkHttpClient 3 / Retrofit 2. In the example I did the login on a web page in a WebView component and then I used the cookie to invoke a service from an activity
//Setup the client
OkHttpClient client = new OkHttpClient.Builder()
.cookieJar(new CookieJar() {
@Override
public void saveFromResponse(HttpUrl url, List<Cookie> cookies) {
}
@Override
@bitmingw
bitmingw / git_batch_resolver.py
Last active September 18, 2023 08:20
Batch script to resolve large git conflicts.
#!/usr/bin/env python3
"""
Author: Ming Wen ([email protected])
When resolving conflicts on a merge or rebase, this script
automates `git add/rm` and `git checkout` with --ours or --theirs
for a large batch of changes.
Usage: `python3 git_batch_resolver.py` in your git repository.
@omarmiatello
omarmiatello / EasyWS.kt
Last active June 4, 2024 13:37
First experiment with WebSocket and Kotlin Coroutine
import kotlinx.coroutines.experimental.CommonPool
import kotlinx.coroutines.experimental.channels.Channel
import kotlinx.coroutines.experimental.launch
import okhttp3.*
import okio.ByteString
import kotlin.coroutines.experimental.suspendCoroutine
/**
* Created by omarmiatello on 17/06/17.
*/
@arvkmr
arvkmr / Photoshop Android Icons.jsx
Created December 1, 2017 21:17
Photoshop script to export icons for Android apps
// Updated version of script by Todd Linkner
// This script is for Photoshop CS6. It outputs Android icons of the
// xxxhdpi - ldpi from a source PSD at least 512px x 512px
/*
// BEGIN__HARVEST_EXCEPTION_ZSTRING
<javascriptresource>
<name>$$$/JavaScripts/OutputAndroidIcons/MenuAlt=Output Android Icons</name>
<category>mobile</category>