Skip to content

Instantly share code, notes, and snippets.

View freakinbook's full-sized avatar

Dmitrii Zviagin freakinbook

  • Russia
View GitHub Profile
@freakinbook
freakinbook / deconstructNumber.js
Created October 25, 2021 15:15
Turn an input string into an array of ints
function deconstructNumber(deconstructee) {
let numberAsArray = [];
let divisor = 10;
let index = 0;
let sign = "";
if (deconstructee.includes("-")) {
deconstructee = deconstructee.substring(1);
sign = "-";
}
if (deconstructee === "0") {
private String printTextPerRole(String[] roles, String[] textLines) {
StringBuilder sb = new StringBuilder();
for (String role : roles){
sb.append(role + ":\n");
for (int line = 0; line < textLines.length; line++){
int indexOfColon = textLines[line].indexOf(":");
String roleInLine = textLines[line].substring(0,indexOfColon);
if (role.equalsIgnoreCase(roleInLine)){
int lineNumInScript = line + 1;
int indexOfSpeech = indexOfColon+1;
@freakinbook
freakinbook / ChangeTextToRefs.bas
Created March 24, 2021 21:41
This VBA code replaces all the occurences of picture references as text for actual cross references.
Attribute VB_Name = "ChangeTextToRefs"
Dim picDic
Private Sub FindByRegexAndReplace(textToFind As String)
Attribute FindByRegexAndReplace.VB_ProcData.VB_Invoke_Func = "Normal.NewMacros.FindAndReplacePicRef"
Dim doc As Document
Dim range As range
Dim picNumber As String
@freakinbook
freakinbook / button_borderless_round.xml
Last active September 14, 2020 14:43
an android button with transparent background and round ripple
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/colorAccent_alpha26">
<item>
<selector>
<item android:state_pressed="false">
<shape
android:shape="oval">
<size android:height="56dp"