Skip to content

Instantly share code, notes, and snippets.

View objcode's full-sized avatar

Sean McQuillan objcode

  • Mountain View, CA
View GitHub Profile
{"videos":[{"title":"Android Jetpack: EmojiCompat","description":"With the EmojiCompat library, part of Jetpack, your app can get backwards-compatible emoji support on devices with API level 19 and higher and get rid of the blank square characters. To use EmojiCompat, initialize the library when the application starts by using downloadable or bundled fonts. Start supporting emojis in your text views, either by integrating the provided widgets or update your custom views by using the provided helper classes. \n\nFor more information:\nEmojiCompat guide → https://goo.gl/7bEoXB \nEmojiCompat sample app → https://goo.gl/7bEoXB \nGoogle I/O 2017 talk on “What’s new in Support Library” → https://goo.gl/KeRvqB\n\nWatch more Android Jetpack videos here → https://goo.gl/kw8LPv\n\nSubscribe to the Android Developers channel here → https://goo.gl/vLYDU\n\n#jetpack #featured","url":"https://www.youtube.com/watch?v=sYGKUtM2ga8","updated":"2018-06-07T17:09:43+00:00","thumbnail":"https://i4.ytimg.com/vi/sYGKUtM2ga8/hqdefaul
@objcode
objcode / percent_width.xml
Created April 16, 2018 21:35
70% width button example
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintWidth_percent="0.70" />
@objcode
objcode / build.gradle
Created April 16, 2018 17:53
1.1.0 Dependency for Constraint Layout
dependencies {
compile 'com.android.support.constraint:constraint-layout:1.1.0'
}
@objcode
objcode / inferrence.kt
Last active September 29, 2017 00:02
Kotlin type puzzle
// In the following declaration, what happens when you call fn()?
val fn: () -> Unit = { "I am not a string" }
// Due to inference, the lambda is evaluated to return Unit and the string is discarded. It is as if you typed,
fun fn(): Unit {
"I am not a string"
return
}
@objcode
objcode / tiered_lights.py
Created September 16, 2017 19:25
Factorio tiered status lights on a tank
# A tiered light indicator is pretty easy to build and this will show you how to build scalable indicators using (2n + 1) decoders
# and one arithmetic. I made mine with three lights, which is enough to understand at a glance what's going on.
#
# You can also put the logic on the lights and use fewer deciders but I prefer this setup because it's easier to modify.
#
# Inputs:
# - R is a constant "ratio". It should be set to the integer value of (tank size - 1 / # of lights).
# - resource types
#
# Variables:
@objcode
objcode / Factorio indicator for tanks
Created September 16, 2017 19:24
How to make a tiered light indicator.
# A tiered light indicator is pretty easy to build and this will show you how to build scalable indicators using (2n + 1) decoders
# and one arithmetic. I made mine with three lights, which is enough to understand at a glance what's going on.
#
# You can also put the logic on the lights and use fewer deciders but I prefer this setup because it's easier to modify.
#
# Inputs:
# - R is a constant "ratio". It should be set to the integer value of (tank size - 1 / # of lights).
# - resource types
#
# Variables:
id,nces_id,state,school_name,school_website,prefix,firstname,lastname,title,email,source,worker
,370002502096,CA,Quality Education Academy,,Mr.,Joe,Alpha,Teacher,[email protected],,
#!/usr/bin/env python
import csv
import sys
def process(fname, ofname):
with open(fname, 'rb') as csvfile:
with open(ofname, 'wb') as writefile:
out_lines = 0;
reader = csv.reader(csvfile)

Keybase proof

I hereby claim:

  • I am objcode on github.
  • I am objcode (https://keybase.io/objcode) on keybase.
  • I have a public key whose fingerprint is 3BF6 CC06 3DE3 4DE7 9DA8 2213 7F4D BEDF 4134 143B

To claim this, I am signing this object:

@objcode
objcode / thread.py
Created November 14, 2011 20:25
defer to thread in gevent
import gevent, gevent.event
import threading, Queue, collections, time, functools
def _threads_poller_f():
while _OsThread._threads_count:
try:
t, rv, isexc = _OsThread._threads_results.get_nowait()
except Queue.Empty:
gevent.sleep()
else: