This file contains 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 ListNode(val) { | |
this.val = val; | |
this.next = null; | |
} | |
const last = arr => arr[arr.length - 1]; | |
const head = arr => arr[0]; | |
const linkedListFromArray = array => head(array.reduce((acc, curr, currIdx, arr) => { | |
let node = new ListNode(curr); |
This file contains 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
#overlay-header, | |
#js-gdpr-consent-banner, | |
#header, | |
#feed-link, | |
#footer, | |
#sidebar, | |
#post-form, | |
.so-header, | |
.bottom-notice, | |
.aside-cta, |
This file contains 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
adb shell screencap -p /mnt/sdcard/output.png | |
adb pull /mnt/sdcard/output.png E:workspace\output.png | |
adb shell rm /mnt/sdcard/output.png |
This file contains 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
package tech.igrant.rxjavaretrofitgson | |
import retrofit2.converter.gson.GsonConverterFactory | |
import retrofit2.Retrofit | |
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory | |
import java.util.HashMap | |
class RetrofitFacade private constructor() { |
This file contains 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
const aRequest = new Promise(resolve => { | |
setTimeout(() => { | |
resolve('3s') | |
}, 3000); | |
}); | |
const bRequest = new Promise(resolve => { | |
setTimeout(() => { | |
resolve('1s') | |
}, 1000); |
This file contains 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
class NetWorkType { | |
companion object { | |
fun wifi(activity: Activity): Boolean { | |
val manager = activity.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager | |
manager.activeNetworkInfo?.let { | |
if (!it.isAvailable) { | |
return false | |
} | |
manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI)?.let { | |
return it.state == NetworkInfo.State.CONNECTING || it.state == NetworkInfo.State.CONNECTED |
This file contains 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
const origin = {}; | |
origin.Date = Date; | |
const flag = {}; | |
flag.installed = false; | |
function install(fixedTs) { | |
if (flag.installed === true) { | |
throw new Error('fixDate has been already installed!'); | |
} | |
const _Date = Date; |
This file contains 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
git config --global alias.co checkout | |
git config --global alias.br branch | |
git config --global alias.ci commit | |
git config --global alias.st status | |
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" |
This file contains 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
// ==UserScript== | |
// @name gayhub moments helper | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://github.com/ | |
// @grant none | |
// ==/UserScript== |
This file contains 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
const fs = require('fs'); | |
const self = src => src; | |
const pipeAble = src => ({ | |
pipe: func => pipeAble(func(src)), | |
track: (fmt = self) => pipeAble(console.log(fmt(src)) || src), | |
ensureObjectNotNull: placeHolder => pipeAble(src || placeHolder || {}), | |
ensureArrayNotNull: placeHolder => pipeAble(src || placeHolder || []), | |
redirect: dest => pipeAble((dest === console.log ? console.log(src) : fs.writeFileSync(dest, src)) || src), | |
strikeWhenBlanking: message => { |
OlderNewer