Skip to content

Instantly share code, notes, and snippets.

View flxwu's full-sized avatar
👨‍💻
Building an ecommerce platform

Felix Wu flxwu

👨‍💻
Building an ecommerce platform
  • dot9.co
View GitHub Profile
@flxwu
flxwu / 01-yarn.config
Created August 18, 2019 14:19
yarn on elastic beanstalk
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/00_set_tmp_permissions.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
chown -R nodejs:nodejs /tmp/.config
"/opt/elasticbeanstalk/hooks/appdeploy/pre/41_install_yarn.sh":
mode: "000775"
import java.util.Scanner;
public class AntiPalindrome {
static int n;
static int len;
static String s;
public static boolean ifpalindrome(char[] str) {
for ( int i=0,j=n-1;i<=j;i++,j--){
if (str[i]!= str[j]) return true ;
}
@flxwu
flxwu / javascript.json
Last active May 24, 2018 13:53
VSCode Snippets
{
"JS Comments Regex": {
"prefix": "regex",
"body": [
"/(\\/\\*[\\w\\'\\s\\r\\n\\*]*\\*\\/)|(\\/\\/[\\w\\s\\']*)|(\\<![\\-\\-\\s\\w\\>\\/]*\\>)/.test(${0:string})"
],
"description": "regex that matches all js comments"
}
}
import sqlite3
def dict_factory(cursor, row):
d = {}
for idx, col in enumerate(cursor.description):
d[col[0]] = row[idx]
return d
# after dbcon
con.row_factory = dict_factory
cur = con.cursor()
@flxwu
flxwu / .hyper.js
Last active April 5, 2018 09:59
Hyper.is Settings
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// Choose either "stable" for receiving highly polished,
// or "canary" for less polished but more frequent updates
updateChannel: 'stable',
@flxwu
flxwu / .eslintrc.js
Last active April 5, 2018 09:59
eslint react config
module.exports = {
"env": {
"browser": true,
"es6": true
},
"extends": ["eslint:recommended", "plugin:react/recommended"],
"parser": "babel-eslint",
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
@flxwu
flxwu / cloudSettings
Last active August 12, 2018 21:12
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-04-23T13:32:37.758Z","extensionVersion":"v2.9.0"}
@flxwu
flxwu / codegolf_mergesort.hs
Created March 23, 2018 09:35
A 106 bytes solution to merge sort
import Data.List
g x|y<-x>>=h=x:[z|x/=y,z<-g y++[sort<$>x]]
h[a]=[[a]]
h x=foldr(\x[b,a]->[x:a,b])[[],[]]x
@flxwu
flxwu / pypi-ghpages.travis.yml
Created March 5, 2018 12:17
TravisCI Setup for PyPi and Github Pages Deployment
deploy:
- provider: pages
skip-cleanup: true
github-token: $GITHUB_TOKEN # Set in travis-ci.org dashboard, marked secure
keep-history: true
on:
branch: master
- provider: pypi
user: "Your username"
password:
@flxwu
flxwu / root
Created May 19, 2017 19:02
nth root
public static double root(double num, double root)
{
return Math.pow(Math.E, Math.log(num)/root);
}