Skip to content

Instantly share code, notes, and snippets.

View hypest's full-sized avatar
😎
Working from anywhere

Stefanos Togoulidis hypest

😎
Working from anywhere
View GitHub Profile
@hypest
hypest / gist:011bc56b85980cdef7e7ece1e57a1664
Created October 16, 2019 07:02
Aztec demo app crash ArrayIndexOutOfBounds in DynamicLayout.getBlockIndex()
2019-10-16 09:51:29.452 6514-6514/org.wordpress.aztec E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.wordpress.aztec, PID: 6514
java.lang.ArrayIndexOutOfBoundsException: length=39; index=-1
at android.text.DynamicLayout.getBlockIndex(DynamicLayout.java:646)
at android.widget.Editor.drawHardwareAccelerated(Editor.java:1695)
at android.widget.Editor.onDraw(Editor.java:1664)
at android.widget.TextView.onDraw(TextView.java:6880)
at android.view.View.draw(View.java:19123)
at android.view.View.updateDisplayListIfDirty(View.java:18073)
at android.view.View.draw(View.java:18851)
@hypest
hypest / aztec-editor-source.patch
Created May 6, 2019 17:19
Trying to use Aztec from source in gutenberg-mobile
diff --git a/app/build.gradle b/app/build.gradle
index 25384818..c9669794 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -2,13 +2,13 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
- compileSdkVersion 27
+ compileSdkVersion 28
@hypest
hypest / gutenberg-changes.diff
Last active February 1, 2019 14:43
easier loading variables.scss and example
diff --git a/packages/block-library/src/code/edit.native.js b/packages/block-library/src/code/edit.native.js
index d4ee2c807..1439c1371 100644
--- a/packages/block-library/src/code/edit.native.js
+++ b/packages/block-library/src/code/edit.native.js
@@ -36,6 +36,7 @@ export default function CodeEdit( props ) {
isSelected={ props.isSelected }
onFocus={ onFocus }
onBlur={ onBlur }
+ fontFamily={ styles.blockCode.fontFamily }
/>
@hypest
hypest / readHashedVersion.gradle
Created December 11, 2018 14:27
Gradle util to extract a GitHub based dependency's hash from package.json
import groovy.json.JsonSlurper
def readHashedVersion(packagejson, packageName, section) {
def packageSlurper = new JsonSlurper()
def packageJson = packageSlurper.parse file(packagejson)
def dep = packageJson.get(section).get(packageName)
def hash = dep.substring(dep.lastIndexOf('#') + 1)
return hash;
}
@hypest
hypest / wait-jitpack.gradle
Last active December 22, 2018 22:12
Manually wait for JitPack to make an artifact available
def waitJitpack(group, module, hash) {
preBuild.dependsOn(tasks.create(name: "waitJitpack-${module}-${hash}") { thisTask ->
def url = "https://jitpack.io/${group.replace('.', '/')}/${module}/${hash}/${module}-${hash}.pom"
def backoffLimit = 7
for (def backoffCount : (0..backoffLimit)) {
def connection = new URL(url).openConnection() as HttpURLConnection
def timeout = (2**backoffCount) * 5 * 1000; // exponential timeout
connection.setConnectTimeout(timeout)
@hypest
hypest / readReactNativeVersion.gradle
Created November 27, 2018 12:23
Gradle util to extract react-native version from package.json
import groovy.json.JsonSlurper
def readReactNativeVersion(packagejson, section) {
def packageSlurper = new JsonSlurper()
def packageJson = packageSlurper.parse file(packagejson)
return packageJson.get(section).get('react-native')
}
ext {
readReactNativeVersion = this.&readReactNativeVersion
@hypest
hypest / submoduleGitHash.gradle
Last active December 6, 2018 12:11
submoduleGitHash() implementation for gradle
def submoduleGitHash(workDir, gitSubmodulePath) {
def stdout = new ByteArrayOutputStream()
exec {
workingDir workDir
commandLine 'git', 'submodule', 'status', gitSubmodulePath
standardOutput = stdout
}
def submoduleStatus = stdout.toString().trim()
def match = (submoduleStatus =~ /^([-+]?)([a-z\d]*) ${gitSubmodulePath}/)
switch (match[0][1]) {
@hypest
hypest / demo.html
Created June 19, 2018 22:55
GB demo post
<!-- wp:cover-image {"url":"https://cldup.com/Fz-ASbo2s3.jpg","align":"wide"} -->
<div class="wp-block-cover-image has-background-dim alignwide" style="background-image:url(https://cldup.com/Fz-ASbo2s3.jpg)">
<p class="wp-block-cover-image-text">Of Mountains &amp; Printing Presses</p>
</div>
<!-- /wp:cover-image -->
<!-- wp:paragraph -->
<p>The goal of this new editor is to make adding rich content to WordPress simple and enjoyable. This whole post is composed of <em>pieces of content</em>—somewhat similar to LEGO bricks—that you can move around and interact with. Move your cursor around and you'll notice the different blocks light up with outlines and arrows. Press the arrows to reposition blocks quickly, without fearing about losing things in the process of copying and pasting.</p>
<!-- /wp:paragraph -->
@hypest
hypest / compile-aztec-directly.patch
Created June 6, 2018 11:31
wpandroid patch to compile Aztec directly
diff --git a/build.gradle b/build.gradle
index 29290bc..fb8d9b4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,6 +1,19 @@
buildscript {
- ext.kotlin_version = '1.2.31'
- ext.arch_components_version = '1.1.1'
+ ext {
+ gradlePluginVersion = '3.0.1'
@hypest
hypest / pegOptions
Created May 15, 2018 15:50
generated grammar parser from post.pegjs
const pegOptions = {
cache: true,
dependencies: {},
format: 'commonjs',
optimize: 'speed',
output: 'source',
trace: false,
};