Skip to content

Instantly share code, notes, and snippets.

@siong1987
siong1987 / Dockerfile
Created July 3, 2023 13:11
Dockerfile to build 0.28.0 anchor with 1.14.18 solana.
#
# Docker image to generate deterministic, verifiable builds of Anchor programs.
# This must be run *after* a given ANCHOR_CLI version is published and a git tag
# is released on GitHub.
#
FROM ubuntu:22.04
ARG DEBIAN_FRONTEND=noninteractive
@siong1987
siong1987 / TPSMonitor.tsx
Created April 29, 2022 15:09
Solana TPS Tracking
import React, { useEffect, useState } from 'react';
import { Connection, PerfSample } from '@solana/web3.js';
import { useAppConfig, useConnection } from '@shared/components-ui/contexts';
import { Trans } from '@lingui/macro';
const WarningIcon = () => {
return (
<svg width="20" height="20" viewBox="0 0 20 21" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
fillRule="evenodd"
func personName(firstName: String, lastName: String?) -> String {
guard let lastName = lastName else {
return "\(firstName)"
}
return "\(firstName) \(lastName)"
}
personName("Siong", lastName: "Ong") // prints "Siong Ong"
personName("Siong", lastName: nil) // prints "Siong"
@siong1987
siong1987 / mrr.rb
Created October 24, 2014 18:31
Stripe MRR Calculation
require 'stripe'
require 'ostruct'
# modified from: https://gist.github.com/jacobpatton/a68d228bf2414852d862
#
# puts Stripe::Mrr.new(api_key: 'api_key').mrr
#
module Stripe
class Mrr
attr_reader :api_key
@siong1987
siong1987 / country_codes.plist
Created June 23, 2014 00:26
Country - Country Code - Calling Code
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>all</key>
<array>
<dict>
<key>calling_code</key>
<string>+93</string>
<key>country</key>

Keybase proof

I hereby claim:

  • I am siong1987 on github.
  • I am siong1987 (https://keybase.io/siong1987) on keybase.
  • I have a public key whose fingerprint is B417 9ED4 3C5B 752D 597C 1B37 CA86 BF84 658B E43B

To claim this, I am signing this object:

class Calculator
def evaluate statement
symbols = statement.split(' ')
puts calculate(symbols)
end
def calculate symbols
if symbols.length == 1
return symbols[0]
else
@siong1987
siong1987 / RestKit.podspec
Created December 17, 2012 09:01
pod spec for Restkit that enables array.
Pod::Spec.new do |s|
s.name = 'RestKit'
s.version = '0.10.3'
s.summary = 'RestKit is a framework for consuming and modeling RESTful web resources on iOS and OS X.'
s.homepage = 'http://www.restkit.org'
s.author = { 'Blake Watters' => 'blakewatters@gmail.com' }
s.source = { :git => 'https://github.com/siong1987/RestKit.git', :tag => 'v0.10.4' }
s.license = 'Apache License, Version 2.0'
s.source_files = 'Code/RestKit.h'
require 'benchmark'
require 'yab62'
def generate_token(length)
(1..length).collect { (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr }.join
end
def generate_mod_token(length)
(rand(62**length)).encode62.rjust(length,rand(62).encode62)
end
@siong1987
siong1987 / forkbin.routes.js.coffee
Created September 22, 2012 22:16
sample routes for forkbin
$(document).ready ->
routes =
"":
"NavbarRouter": "index"
"ListsRouter": "index"
"lists/:id":
"NavbarRouter": "index"
"ListsRouter": "show"