Skip to content

Instantly share code, notes, and snippets.

View ChrisZou's full-sized avatar

Chris ChrisZou

View GitHub Profile
@ChrisZou
ChrisZou / preview_svgs.rb
Created September 11, 2020 16:10
One-line Ruby to preview all svg files in a dir
Dir["*.svg"].map { "<img src='./#{_1}' style='width: 100px; height: 100px; margin: 20px' /> " }.join("\n").then { File.write("result.html", _1); system("open result.html") }
@ChrisZou
ChrisZou / phoenix_channel_wechat_miniprogram_client_transport.js
Last active July 24, 2018 02:04
Phoenix Channel WeChat miniProgram client transport
//This is a WeChat miniprogram client transport for phoenix.js
// so that you can use easily use Phoenix Channel as a WebSocket server.
// Written by @chrismccord
// example usage:
// ```
// let socket = new Socket("ws://localhost:4000/socket", { transport: WxSocket })
// socket.connect()
// let channel = socket.channel("room:lobby", {})
// channel.join()
// .receive("ok", resp => { console.log("Joined successfully", resp) })
@ChrisZou
ChrisZou / standard .classpath file for eclipse android project
Created November 6, 2014 00:03
Eclipse Android project classpath files
<?xml version="1.0" encoding="UTF-8"?>
<!-- You dont need to change anything in this file -->
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
@ChrisZou
ChrisZou / Android create option menu in Activity
Last active December 23, 2015 08:08
Android commonly used code
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will