This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class ExampleViewHolder extends RecyclerView.ViewHolder | |
| implements View.OnClickListener { | |
| private int originalHeight = 0; | |
| private boolean isViewExpanded = false; | |
| private YourCustomView yourCustomView | |
| public ExampleViewHolder(View v) { | |
| super(v); | |
| v.setOnClickListener(this); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Put space into string between chunks of same length */ | |
| fun String.spacer(unitLength: Int = Int.MAX_VALUE, spaceCharacter: String = " "): String = chunked(unitLength).joinToString(spaceCharacter) | |
| /** | |
| * e.g. | |
| * "123456789012345678".spacer(4) => "1234 5678 9012 3456 78" | |
| * "123456789012345678".spacer(4, "@") => "1234@5678@9012@3456@78" | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # http://codepen.io/morewry/pen/pvLxPV | |
| # manually create touch event | |
| touchStartOn = (el, x = 0, y = 0) -> | |
| try | |
| e = document.createEvent('TouchEvent') | |
| e.initTouchEvent("touchstart", true, true) | |
| catch err | |
| try | |
| e = document.createEvent('UIEvent') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function b64EncodeUnicode(str) { | |
| return btoa( unescape( encodeURIComponent( str ) ) ); | |
| } | |
| function b64DecodeUnicode(str) { | |
| return decodeURIComponent( escape( atob( str ) ) ); | |
| } |
Visit my blog or connect with me on Twitter
git init
or
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Content Script to save data. | |
| chrome.extension.sendRequest({storage: 'foo', value: 'bar'}); | |
| // Content Script to get data. | |
| chrome.extension.sendRequest({storage: 'foo'}, function(response) { | |
| console.log('foo => ' + response.storage); | |
| }); | |
| // Background Page |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Building a router</title> | |
| <script> | |
| // Put John's template engine code here... | |
| (function () { | |
| // A hash to store our routes: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| server { | |
| listen 80; | |
| server_name localhost; | |
| root /home/bookworm/Sites; | |
| index index.php index.html index.htm; | |
| try_files $uri $uri/ /index.php; | |
| location ~ \.php$ { | |
| fastcgi_pass 127.0.0.1:9001; |