Skip to content

Instantly share code, notes, and snippets.

View cashlo's full-sized avatar

Cash TingHin Lo cashlo

  • Indeed.com
  • Tokyo
View GitHub Profile
package com.centralway.numbrs.numbrsapp.views;
import android.content.Context;
import android.graphics.Canvas;
import android.support.design.widget.TextInputLayout;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
package com.centralway.numbrs.numbrsapp.views;
import android.content.Context;
import android.graphics.Canvas;
import android.support.design.widget.TextInputLayout;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
@cashlo
cashlo / app.js
Created August 23, 2011 03:45 — forked from dawsontoth/app.js
Loading images in @appcelerator #Titanium
/* The images for this example can be downloaded from http://j.mp/loadingimagesforti */
var win = Ti.UI.createWindow({ backgroundColor: '#f00'});
var loading = Ti.UI.createImageView({
images: [
'images/loading/00.png', 'images/loading/01.png', 'images/loading/02.png',
'images/loading/03.png', 'images/loading/04.png', 'images/loading/05.png',
'images/loading/06.png', 'images/loading/08.png', 'images/loading/09.png',
'images/loading/10.png', 'images/loading/11.png'
],
width: 33, height: 33
var mySockets = [];
var server = net.createServer(function (socket) {
socket.write("Echo server\r\n");
mySockets.push(socket);
socket.on('data',function(data){
mySockets.forEach(function(s){
s.write(data);
});
});
fetch('https://cors.io/?https://www.duolingo.com/users/CashLo')
.then(response => response.json())
.then(json => console.log(json))
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def addTwoNumbers(self, l1, l2):
"""
:type l1: ListNode
class Solution(object):
def lengthOfLongestSubstring(self, s):
"""
:type s: str
:rtype: int
"""
max_length = 0
seen_dict = {}
sub_start = 0
for i, c in enumerate(s):
class Solution(object):
def lengthOfLongestSubstring(self, s):
"""
:type s: str
:rtype: int
"""
max_length = 0
seen_dict = {}
sub_start = 0
for i, c in enumerate(s):
class Solution(object):
def find_number_after(self, nums1, nums2, left, take_numbers):
if len(nums1) + len(nums2) <= 10 or len(nums1) < 2 or not len(nums2) < 2:
jointed = []
jointed.extend(nums1)
jointed.extend(nums2)
jointed.sort()
return jointed[left:left+take_numbers]
left1 = len(nums1) * left / ( len(nums1) + len(nums2) )
left1 = max(left1, left - len(nums2) + 1)
def result(o):
return eval(o)
def get_all_options(num, tail, target):
if len(num) == 0:
return {}
if len(num) == 1:
return {int(num): [ num ] }
last_dict = get_all_options(num[:-1], num[-1] + tail, target)
curr_dict = {}