Skip to content

Instantly share code, notes, and snippets.

🎶
WHEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE!!

Thai Pangsakulyanont dtinth

🎶
WHEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE!!
  • Taskworld; spacet.me Labs
  • Krungthepmahanakhonamonrattanakosinmahintharayutthayamahadilokphopnoppharatratchathaniburiromudomratchaniwetmahasathanamonphimanawatansathitsakkathattiyawitsanukamprasit (Bangkok), Thailand
Block or report user

Report or block dtinth

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dtinth
dtinth / decrypt.clj
Created Sep 5, 2017
Node.js encrypt -> Clojure decrypt RSA
View decrypt.clj
(defn load-private-key
[key-str]
(crypto/decode-private-key {:algorithm "RSA"
:bytes (-> key-str
crypto/decode-base64)}))
(defn decrypt-str
[private-key text-to-decrypt]
(let [cipher (crypto/create-cipher "RSA/ECB/OAEPWithSHA1AndMGF1Padding")]
(crypto/decrypt private-key
View garbage.js
const memoizeArraySelector = (baseSelector) => {
let _last = [ ]
return (state) => {
const result = baseSelector(state)
if (arrayEquals(result, _last)) return _last
_last = result
return result
}
}
View JS snippets.cson
'.source.js':
'import react':
prefix: 'ir'
body: '''
import React from 'react'
'''
'export function':
prefix: 'ef'
body: '''
export function $1 ($2) {
View FirebaseAuth.js
export class FirebaseAuth extends React.Component {
static propTypes = {
children: PropTypes.func.isRequired
}
auth = firebase.auth()
state = { user: this.auth.currentUser }
componentDidMount () {
this.unsubscribe = this.auth.onAuthStateChanged(user => {
this.setState({ user })
})
View mojibake.md

When extracting .zip files with Japanese encoding using p7zip in UTF-8 locale, a double-encoded file name is created:

\u0082±\u0082ñ\u0082É\u0082¿\u0082Í\u0081I.txt

Upon closer inspection, some code-points are > 127 and all of them < 256.

> filename.codepoints
View GitHub Highlight Code Review.css
a[aria-label^="Review required"] {
background: #cb2431 !important;
color: white !important;
padding-left: 3px;
padding-right: 3px;
display: inline-block;
}
a[aria-label$="requesting changes"] {
color: orange !important;
}
@dtinth
dtinth / ioc.diff
Created Jan 29, 2017
Use an IoC container
View ioc.diff
function main () {
return Promise.coroutine(function * () {
- const logger = log4js.getLogger('main')
-
- logger.info('Loading certificate...')
- const JWT_CERTIFICATE_URL = requiredEnv('JWT_CERTIFICATE_URL')
- const certificate = (yield axios.get(JWT_CERTIFICATE_URL)).data
-
- logger.info('Connecting to MongoDB...')
- const DEFAULT_MONGO_URL = 'mongodb://127.0.0.1:27017/bemuse'
@dtinth
dtinth / unwieldy.js
Last active Jan 29, 2017
I think I need an IoC container…
View unwieldy.js
function main () {
return Promise.coroutine(function * () {
const DEFAULT_MONGO_URL = 'mongodb://127.0.0.1:27017/bemuse'
const suppliedMongoUrl = process.env.MONGO_URL || process.env.MONGODB_URI
const db = yield connectMongo(suppliedMongoUrl || DEFAULT_MONGO_URL)
const factory = new MongoDBRepositoryFactory({ db })
const port = +process.env.PORT || 8008
const app = createApiServer({
logger: log4js.getLogger('HTTP'),
legacyUserApiKey: requiredEnv('LEGACY_USER_API_KEY'),
View Key.md

โจทย์หลักที่ต้องการแก้

เลขสามหลัก.filter(n => เงื่อนไข.every(ใช้ได้กับ(n)))

แก้ปัญหาย่อย

  • เลขสามหลัก
View Code in the dark round1.html
<!DOCTYPE html>
<style>
body {
background: black;
color: white;
font: 16px Courier New;
}
#header {
height: 32px;
position: relative;
You can’t perform that action at this time.