Skip to content

Instantly share code, notes, and snippets.

View shangoyanyi's full-sized avatar

chih-kuang,wu shangoyanyi

View GitHub Profile
<div style='width:200px; margin:auto; border:1px solid #ddd; text-align:center; border-radius:25px;'>
<div style='margin:15px;'></div>
<div style='width:40px; height:5px; margin:auto; border:1px solid #ddd; text-align:center; border-radius:20px;'>&nbsp;</div>
<div style='margin:15px;'></div>
<div style='width:190px; height:300px; margin:auto; border:1px solid #ddd'>
<div style='margin:100px;'></div>
<label>Title</label>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas nulla magna, mattis in nulla eu, tempus gravida massa. Duis vitae porta velit. Suspendisse in ultricies ante. Integer venenatis, erat nec tincidunt gravida, velit felis laoreet metus, sed ullamcorper felis tellus congue odio. Maecenas ullamcorper, tortor vel luctus dictum, mauris risus tincidunt nisl, id molestie libero arcu sagittis dolor. Praesent in felis at turpis pharetra sagittis id ut ante. Vestibulum tempus cursus erat, eget varius sem. Vivamus imperdiet efficitur libero. Nulla ut arcu lacinia,
@shangoyanyi
shangoyanyi / ResourceReader.java
Created September 15, 2017 07:43
how to read resource in JavaEE
public class ResourceReader{
/*
* filePath 是檔案所在的 package ,將 "." 改為 "/"
* 例如檔案 config.txt 所在 package 是 my.resource
* 則 filePath = "my/resource/config.txt"
*/
public void readResource(String filePath){
InputStream in = ResourceReader.class.getClassLoader().getResourceAsStream(filePath);
}
}
em.remove(em.contains(entity)? entity: em.merge(entity));
/*
* Paste this code in SublimeText3 -> Preferences -> Key Bindings-User to enable emmet for jsx
*/
[{
"keys": ["tab"],
"command": "expand_abbreviation_by_tab",
"context": [
{
"operand": "source.js",
"operator": "equal",
var BookmarksIsEmpty = React.createClass({
render: function(){
return (
<div className='bookmark-empty'>
<img src='http://2.bp.blogspot.com/-uS_sqEbi9Po/U4K7HV1_XII/AAAAAAAAARQ/jv5z0zvIyGw/s1600/Pikachu.600.1445652.jpg' />
</div>
);
}
});
@shangoyanyi
shangoyanyi / webpack.config.js
Last active May 17, 2016 09:33
webpack config with multi-entry and multi-output-path
var webpack = require("webpack");
module.exports = {
entry:{
//左邊字串就是下方 output 區塊的 [name],透過這種方式就可以把檔案輸出到不同路徑下
'popup/popup' : './app/main/src/pages/popup/popup.js',
'settings/settings' : './app/main/src/pages/settings/settings.js'
},
output: {
filename: '[name].bundle.js',
/*
* some useful utilities
*/
// check an object is empty or not
function isEmpty(obj) {
for(var prop in obj) {
if(obj.hasOwnProperty(prop))
return false;
}
@shangoyanyi
shangoyanyi / chocolatey install guide
Last active May 17, 2016 09:29
chocolatey install guide
chocolatey install guide
@shangoyanyi
shangoyanyi / spotify-oauth-in-react.js
Last active June 16, 2017 17:31
React - do spotify oauth with React
var React = require("react");
module.exports = React.createClass({
...,
// open new spotify oauth window
handleLoginRequest: function(){
var url = 'https://accounts.spotify.com/authorize' +
'?client_id=' + this.props.clientId +
'&redirect_uri=' + encodeURIComponent(this.props.redirectUri) +
'&scope=' + encodeURIComponent(this.props.scope) +
public static <T, E> Set<T> getKeysByValue(Map<T, E> map, E value) {
Set<T> keys = new HashSet<T>();
for (Entry<T, E> entry : map.entrySet()) {
if (entry.getValue().equals(value)) {
keys.add(entry.getKey());
}
}
return keys;
}