Skip to content

Instantly share code, notes, and snippets.

@paul-ylz
paul-ylz / redux-form-localized-server-alert-example.js
Created May 4, 2019 05:46
React-Native: Example of alerting localizing server messages in the front end, using Alert.alert, and redux-form
import React from "react";
import { Alert, Button } from "react-native";
import { SubmissionError } from "redux-form";
// localization.js
// Each type of API call must have a "default" message
const localizedStrings = {
en: {
somethingWentWrong: "Oops, we're sorry, something went wrong",
"serverErrors.widgetSubmit.default":
@paul-ylz
paul-ylz / quicksort.rb
Last active April 29, 2018 09:43
Quicksort in ruby
# Quicksort is a ruby implementation of the well-known algorithm
# https://en.wikipedia.org/wiki/Quicksort
class Quicksort
# sort will recursively run the partition function
# lo and hi identify the index range to be sorted
def sort(arr, lo, hi)
return unless lo < hi
pidx = partition(arr, lo, hi)
sort(arr, lo, pidx - 1)
sort(arr, pidx + 1, hi)
@paul-ylz
paul-ylz / apns_conn_handler.rb
Created May 26, 2016 07:16
Houston APNS - persistent connection with error handling
# With thanks to Houston gem maintainers and
# http://joshsymonds.com/blog/2013/10/17/sidekiq-plus-houston-production-ready/
#
module ApnsConnHandler
class ApnConnection
def initialize
setup()
end
@paul-ylz
paul-ylz / map.geojson
Created August 23, 2013 08:48
via:geojson.io
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@paul-ylz
paul-ylz / map.geojson
Created August 21, 2013 14:48
via:geojson.io
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@paul-ylz
paul-ylz / map.geojson
Created August 20, 2013 09:47
via:geojson.io
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

  • I am paul-ylz on github.
  • I am paulyeoh (https://keybase.io/paulyeoh) on keybase.
  • I have a public key whose fingerprint is 7586 E1DB 2956 E7C8 866D 3524 91E2 B4A5 CFAC 95B7

To claim this, I am signing this object: