Skip to content

Instantly share code, notes, and snippets.

View worker8's full-sized avatar
:octocat:
code is compiling...

Tan Jun Rong worker8

:octocat:
code is compiling...
View GitHub Profile
/* Returns either the index of the location in the array,
or -1 if the array did not contain the targetValue */
/* note to self: took around 40~50 mins to get the answer */
/* note to self: took even longer to make the program pass because the checking is a bit rigid, I used round() instead of floor, and it wouldn't let me pass,
it does help me to think about many different ways of solving though. */
var doSearch = function(array, targetValue) {
var min = 0;
var max = array.length - 1;
var midpoint;
// roughly 10 mins
var swap = function(array, firstIndex, secondIndex) {
var temp = array[firstIndex];
array[firstIndex] = array[secondIndex];
array[secondIndex] = temp;
};
var indexOfMinimum = function(array, startIndex) {
var minValue = array[startIndex];
@worker8
worker8 / to-do-list.md
Created April 13, 2016 14:40
Help me record what I've been doing and learning lately

Android Weekly

read read!

Pixels for Reddit

  • Stability test
  • Write test cases in words
  • Turn worded-test cases into real tests
  • Fix the momentarily blank screen that appears on main screen (between progress bar disappearance and content appearance)
@worker8
worker8 / sed 101
Last active March 18, 2026 03:38
Useful sed regex collection
http://sed.sourceforge.net/sed1line.txt
-------------------------------------------------------------------------
USEFUL ONE-LINE SCRIPTS FOR SED (Unix stream editor) Dec. 29, 2005
Compiled by Eric Pement - pemente[at]northpark[dot]edu version 5.5
Latest version of this file (in English) is usually at:
http://sed.sourceforge.net/sed1line.txt
http://www.pement.org/sed/sed1line.txt
import com.google.android.gms.auth.GoogleAuthException;
import com.google.android.gms.auth.GoogleAuthUtil;
import com.google.android.gms.auth.UserRecoverableAuthException;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.common.Scopes;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.plus.Plus;
import com.google.android.gms.plus.model.people.Person;
@worker8
worker8 / gist:5e00248f69ef7beeeda3e9cdb941a902
Created December 18, 2017 07:35
Kotlin standard library renaming
import kotlin.apply as doOnly
import kotlin.run as doTransform
import kotlin.also as doOnlyIt
import kotlin.let as doTransformIt
GitHub pull request #2880 of commit 25eaa11b45b365d8000e4b9cbc94b0149bef6675, has merge conflicts.
Setting status of 25eaa11b45b365d8000e4b9cbc94b0149bef6675 to PENDING with url https://jenkins.ckpd.co/job/android-global-pull-request/4058/ and message: 'Build started sha1 is original commit.'
Using context: small test
Building remotely on ci-slave-android-003 (android) in workspace /mnt/vol/jenkins/workspace/android-global-pull-request
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url git@github.com:cookpad/global-android.git # timeout=10
Cleaning workspace
> git rev-parse --verify HEAD # timeout=10
Resetting working tree
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->
<!--reds-->
<color name="md_red_50" tools:ignore="UnusedResources">#FFEBEE</color>
<color name="md_red_100" tools:ignore="UnusedResources">#FFCDD2</color>
<color name="md_red_200" tools:ignore="UnusedResources">#EF9A9A</color>
require 'nokogiri'
require 'pry'
require 'open-uri'
class Parse
def loadFile
puts "start.."
file = File.read("raw_html5")
result = Nokogiri::XML(file)
rootNode = result.children
@worker8
worker8 / sample.kt
Last active October 18, 2018 04:07
fun onCreate() {
// step 1
constraintLayout = LayoutInflater.from(this)
.inflate(R.layout.empty_constraint_layout, constraintLayout, false)
titleView = LayoutInflater.from(this)
.inflate(R.layout.title_view, constraintLayout, false) setContentView(constraintLayout)
}