Skip to content

Instantly share code, notes, and snippets.

View lulalachen's full-sized avatar
🎯
Focusing

Lulala Chen lulalachen

🎯
Focusing
View GitHub Profile
@lulalachen
lulalachen / alternative.sh
Last active March 29, 2019 22:15
Copy the curl from the network and run this command in terminal
# Or you can replace the `pbpaste` with the curl you copied
# and remember to add a `\` and the end of line
curl 'https://url.com/auth/v1/login?type=admin' -X POST -H 'Accept: application/json' -H 'Referer: https://url.com/login?next=/profile/personal' -H 'Origin: https://urlcom' -H 'User-Agent: Chrome/73.0.3683.86 Safari/537.36' -H 'Authorization: Basic xxxxxxxxxxx' -H 'Content-Type: application/json' --compressed \
| bash \
| tr -d '[:space:]' \
| sed -e 's/roles/role/g' \
| sed -e 's/\["/"/g' \
| sed -e 's/\"]/"/g' \
| ( \
const curry = require('ramda').curry // or other library
// Section 1
const add = (a, b) => a + b
add(1, 2) // 3
add(1) // NaN
const add_curried = curry(add)
add(1, 2) // 3
add(1)(2) // 3

Add SSH Keys into Github

  • ssh-keygen ( Press Enter all the way )
  • cat ~/.ssh/id_rsa.pub | pbcopy

Repo initiator

import * as R from 'ramda'
// Usage: parseQueryString(location.search) -> { key1: value2, key2: value2, ... }
// parseQueryString => String -> { k: v }
const parseQueryString = R.pipe(
R.when(
R.test(/^\?/),
R.drop(1),
),
class Solution(object):
def getShipCountInRow(self, row):
ships = 0
isShipContinuous = False
for txt in row:
if txt == u'X':
isShipContinuous = True
if isShipContinuous and txt == u'.':
isShipContinuous = False
ships += 1
.hoverReplacement_12521621 {
background-image: url('http://payload532.cargocollective.com/1/23/738089/12950292/prt_495x227_1498051145.png');
}
.hoverReplacement_12521621:hover {
background-image: url('http://payload532.cargocollective.com/1/23/738089/12950292/prt_495x227_1498051145.png') !important;
}
.hoverReplacement_12521713 {
background-image: url('http://payload532.cargocollective.com/1/23/738089/12950292/prt_495x227_1498051145.png');
root@TimeXchange-stagging:/etc/nginx# cat sites-enabled/happybirthday.hangee.me
server {
listen 80;
server_name happybirthday.hangee.me;
root /www/hangee/docs;
location ~ (?:.+\/)((?:.+)\.(?:.+)) {
# $1 is the filename
try_files $uri /$1 /css/$1 =404;
// ES6
const add = firstNumber = secondNumber => firstNumber + secondNumber
// ES5
var add = function (firstNumber) {
return function (secondNumber) {
return firstNumber + secondNumber
}
}
@lulalachen
lulalachen / initializeServer.sh
Created July 19, 2016 13:58
Initialize Ubuntu Server 14.04.4 x64
# Update apt-get sources
sudo apt-get update
# Install git
sudo apt-get install git
# Install nvm
# To install or update nvm, you can use the install script using cURL:
# Check newest version: [release](https://github.com/creationix/nvm/releases)
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | bash # OR