I hereby claim:
- I am ruiwen on github.
- I am ruiwen (https://keybase.io/ruiwen) on keybase.
- I have a public key ASC6hOGJ6j8XRLof2za5Fe_gXhtXOOo42WrNt_6tH-W3Bwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| # Bash function to translate redis commands to their pipelined equivalent | |
| # | |
| # eg. | |
| # | |
| # $ redis_p HMSET key value key1 value1 | |
| # *5 | |
| # $5 | |
| # HMSET | |
| # $3 | |
| # key |
| # Obtaining server certificate | |
| openssl s_client -CAfile ca.crt -connect "server.domain.com:443" < /dev/null 2> /dev/null | openssl x509 -outform PEM > server.crt | |
| # You may get an error like the following | |
| # CONNECTED(00000003) | |
| # 140048174458520:error:140790E5:SSL routines:ssl23_write:ssl handshake failure:s23_lib.c:177: | |
| # --- | |
| # no peer certificate available | |
| # --- | |
| # No client certificate CA names sent |
A Pen by Ruiwen Chua on CodePen.
| angular.module('utils') | |
| .directive('sq-content', [ | |
| '$log' | |
| '$window' | |
| ($log, $window) -> | |
| restrict: 'A' | |
| link: (scope, elem, attrs) -> | |
| # Calculates and sets the height of element to fully take up | |
| # the rest of the vertical height in a page | |
| # Mainly used for activating overflow: scroll for md-content |
| function keypress(n) { | |
| var keyboardEvent = new KeyboardEvent('keydown', {bubbles:true}); | |
| Object.defineProperty(keyboardEvent, 'charCode', {get:function(){return this.charCodeVal;}}); | |
| Object.defineProperty(keyboardEvent, 'keyCode', {get: function(){return this.charCodeVal;}}); | |
| keyboardEvent.charCodeVal = n; | |
| document.body.dispatchEvent(keyboardEvent); | |
| } |
| function Enum() { | |
| var self = this; | |
| var vals = {}; | |
| for(var i=0; i < arguments.length; ++i) { | |
| vals[arguments[i]] = i == 0? 0 : Math.pow(2, i-1) | |
| vals[i] = i == 0? 0 : Math.pow(2, i-1) | |
| Object.defineProperty(self, arguments[i], { | |
| 'value': vals[arguments[i]], | |
| }) | |
| } |
| package com.thoughtmonkeys.pitstop; | |
| import android.annotation.TargetApi; | |
| import android.content.Context; | |
| import android.content.res.Resources; | |
| import android.graphics.RectF; | |
| import android.os.Build; | |
| import android.text.Layout.Alignment; | |
| import android.text.StaticLayout; | |
| import android.text.TextPaint; |
| package com.thoughtmonkeys.pitstop; | |
| import java.util.ArrayList; | |
| import java.util.List; | |
| import android.content.Context; | |
| import android.graphics.Paint; | |
| import android.util.AttributeSet; | |
| import android.util.Log; |