Skip to content

Instantly share code, notes, and snippets.

View hongkheng's full-sized avatar
🐢
doing hobby stuff

HongKheng Yap hongkheng

🐢
doing hobby stuff
View GitHub Profile
@hongkheng
hongkheng / godevjd.md
Last active June 7, 2018 02:58
SP Digital Go backend developer job description

Why Work for Us

We Power the Nation.

Make the most of your talents and develop products that can create an impact on a national scale. We are an in-house software team, assembled to move with speed and deliver with quality.

We Build Reliable Solutions. For Customers, Company and Country.

@hongkheng
hongkheng / calabash_steps.rb
Created August 28, 2017 05:38
Calabash tips and tricks
# Asking user input into the cli
Then(/^I enter the sms otp$/) do
print "Enter the otp digit within 30 seconds?"
otp = STDIN.gets
wait_for_keyboard
keyboard_enter_text otp
sleep(STEP_PAUSE)
end
@hongkheng
hongkheng / publish-ghpages.md
Created August 7, 2017 14:49 — forked from tduarte/publish-ghpages.md
If you need to force push an subtree
git checkout master # you can avoid this line if you are in master...
git subtree split --prefix dist -b gh-pages # create a local gh-pages branch containing the splitted output folder
git push -f origin gh-pages:gh-pages # force the push of the gh-pages branch to the remote gh-pages branch at origin
git branch -D gh-pages # delete the local gh-pages because you will need it: ref
@hongkheng
hongkheng / npm.sh
Created August 7, 2017 07:30
npm scripts execution
npm run pre-build && npm run build_logic && npm run post_build && npm run exit
// `&&` for sequential execution
// `&` for parrallel execution
@hongkheng
hongkheng / ShowAlert.swift
Created April 10, 2017 01:37
Find the rootViewController to present alert globally
if var topController = UIApplication.shared.keyWindow?.rootViewController {
while let presentedViewController = topController.presentedViewController {
topController = presentedViewController
}
// topController should now be your topmost view controller
// Dismissing an UIAlertController which is being displayed and setting the topController down one level
if topController is UIAlertController {
if let vc = topController.presentingViewController {
topController = vc
vc.dismiss(animated: true, completion: nil)
@hongkheng
hongkheng / servo.js
Last active December 6, 2016 09:32
cylon.js sweeping servo
/**
* Test script for testing a full sweep of a servo. This is to get the minimum and the maximum degree of the angle.
*/
Cylon.robot({
name: 'Servo1',
connections: {
arduino: { adaptor: 'firmata', port: '/dev/ttyACM0' } // hard-coded serial port address
},
@hongkheng
hongkheng / keybase.md
Created June 15, 2016 02:17
keybase ID

Keybase proof

I hereby claim:

  • I am hongkheng on github.
  • I am wbakura (https://keybase.io/wbakura) on keybase.
  • I have a public key whose fingerprint is D3BB 665E 70FD DED8 9D34 5DE3 C464 4096 407C 70C3

To claim this, I am signing this object:

@hongkheng
hongkheng / scroller
Created June 29, 2015 02:40
css scroller
.surface {
transform: translate3d(0,0,y);
backface-visibility: hidden;
}
@hongkheng
hongkheng / movingave.js
Last active August 29, 2015 14:23
Moving average
//Moving average
// v(t) = a * V(t) + (1-a)*v(t-1)
// http://scrollerjs.com/talks/velocity2014/#1
function moveStep () { // triggered every 17ms~
var v = (currentPos - prevPos) / (currentTime - prevTime); // current velocity
self.velocity = 0.6 * v + 0.4 * self.velocity; // Applying moving average formmula
self.translate(self.x, self.y); // debounce move event from animation
requestAnimationFrame(moveStep);
@hongkheng
hongkheng / longpress
Created May 7, 2015 03:46
Long press jquery
var timeoutId = 0;
$('#myElement').mousedown(function() {
timeoutId = setTimeout(myFunction, 1000);
}).bind('mouseup mouseleave', function() {
clearTimeout(timeoutId);
});