Skip to content

Instantly share code, notes, and snippets.

View Jei's full-sized avatar
🇦🇺
Currently in Melbourne

Andrea Jonus Jei

🇦🇺
Currently in Melbourne
View GitHub Profile
#!/bin/bash
#
# Send adb commands to all connected devices.
#
# Usage: adb-all COMMANDS
#
adb devices | tail -n +2 | cut -sf 1 | xargs -I {} adb -s {} $@
#!/bin/bash
##
# Author: Andrea Jonus <andrea.jonus@caffeina.com>
# Version: 0.3
# Description: Setup the MacOS build environment for a Titanium project. Run this script once for every machine, copy the generated ssh public key and add it to GitLab.
##
# Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@Jei
Jei / mapToFormData.dart
Created January 15, 2019 10:18
A simple method that reads a Map and returns a new map formatted as form data for https://pub.dartlang.org/packages/http
Map<String, String> mapNested(Map<String, dynamic> obj, [Map<String, String> current, String namespace]) {
Map<String, String> res = current != null ? current : Map<String, String>();
for (String key in obj.keys) {
String newKey = namespace != null ? '$namespace[$key]' : key;
if (obj[key] is Map) {
mapNested(obj[key], res, key);
} else if (obj[key] is List) {
for(int i = 0; i < obj[key].length; i++) {
@Jei
Jei / chill.liq
Last active April 10, 2018 13:35
# CONFIG FILE
%include "config/chill.config.liq"
# OTHER CONFIGS
set("log.file.path", "/usr/share/liquidsoap/logs/<script>.log")
set("init.daemon.pidfile.path", "/var/run/liquidsoap/<script>.pid")
# PLAYLISTS
enable_replaygain_metadata()
vaporwave = playlist("#{mediaDir}/playlists/vaporwave", mode='randomize', reload_mode="watch", prefix="replay_gain:")
@Jei
Jei / NestedScrollViewManager.js
Created February 20, 2018 16:53 — forked from jpriebe/NestedScrollViewManager.js
Appcelerator Titanium code for managing scrollviews inside of scrollviews
function NestedScrollViewManager (parent_view, child_views)
{
// Appcelerator Titanium code for managing scrollviews inside of scrollviews (not true Android
// NestedScrollViews, but just a horizontal scrollview inside of a vertical scrollview).
//
// If you want to put a horizontal scrollview inside a vertical scrollview (like the Netflix app UI),
// it seems to work reasonably well on iOS. But on android, the user experience is very janky.
// Unless the user's drag movements are nearly exactly horizontal, there will be some movement of
// the parent scrollview, and then it becomes very difficult to scroll the child view. Flinging is
// almost impossible.
@Jei
Jei / tiapp-cfg.json
Created February 6, 2018 17:42
tiapp-cfg.json example for tiapp-composer-plugin
{
"development": {
"app": {
"id": "com.caffeinalab.tiappcomposer.example",
"version": "1.1.0",
"sdkVersion": "6.3.0.GA",
"ios": {
"supportedOrientations": {
"iphone": "<string>UIInterfaceOrientationPortrait</string><string>UIInterfaceOrientationLandscape</string>"
}
@Jei
Jei / tiapp.tpl
Created February 6, 2018 17:41
tiapp.tpl example for tiapp-composer-plugin
<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
<id>${app.id}</id>
<name>example</name>
<version>${app.version}</version>
<publisher>not specified</publisher>
<url>caffeina.com</url>
<description></description>
<copyright>not specified</copyright>
<icon>appicon.png</icon>
@Jei
Jei / telegrammessagesplitter.js
Created March 28, 2017 08:27
Telegram message splitter regex.
// The maximum length of a Telegram text message is 4096 UTF8 characters.
// This regex splits a string in parts of 4096 characters at most, ending with newline.
exports.splitMessage = function(text) {
return text.match(/([^\s][\w\W\n]{0,4096})(?=\n[\w\W\n]*|$)/gi);
}
@Jei
Jei / rcolor.js
Created February 1, 2017 11:35
RColor class for Titanium. Taken from https://github.com/sterlingwes/RandomColor and slightly modified.
function RColor() {
this.hue = Math.random();
this.goldenRatio = 0.618033988749895;
this.hexwidth = 2;
}
RColor.prototype.hsvToRgb = function (h,s,v) {
var h_i = Math.floor(h*6),
f = h*6 - h_i,
p = v * (1-s),
@Jei
Jei / keybase.md
Last active January 25, 2016 18:37
keybase proof

Keybase proof

I hereby claim:

  • I am jei on github.
  • I am jeithings (https://keybase.io/jeithings) on keybase.
  • I have a public key ASDpp7HciI_nxirYgkT90yT0OGeRjYW-joiZVJGPod7Fwwo

To claim this, I am signing this object: