This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
</head> | |
<body> | |
<div style="height: 1px;"></div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def render_with_cache key, options, render_name, render_options | |
cache_body = Rails.cache.read(key) | |
if cache_body | |
render text: cache_body | |
else | |
render render_name, render_options | |
Rails.cache.write(key, response.body, options) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body> | |
<div><input type="file" id="file" /></div> | |
<script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
const src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js" | |
const sc = document.createElement("script") | |
sc.type="text/javascript" | |
sc.src=src | |
sc.onload = () => { | |
html2canvas(document.body, { | |
onrendered: (canvas) => { | |
const imgageData = canvas.toDataURL("image/png") | |
const newData = imgageData.replace(/^data:image\/png/, "data:application/octet-stream") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8" /> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js"></script> | |
<script src="./index.js"></script> | |
<style type="text/css"> | |
div { | |
width: 800px; | |
margin: 0 auto; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
let dragStart = false | |
let div | |
let startX, startY = 0 | |
const evtMouseDown = (e) => { | |
dragStart = true | |
document.body.style.userSelect = 'none' | |
div = document.createElement('div') | |
div.style.backgroundColor = '#ddd' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const init = { | |
key1: 100 | |
} | |
const merge = (data) => { | |
return Object.assign(init, data) | |
} | |
const newData = merge({key2: 200}) | |
newData == init | |
// => true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo { | |
constructor() { | |
this.result = '' | |
} | |
method_a () { | |
console.log('method_a') | |
this.result += 'method_a ' | |
return this | |
} | |
method_b () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hoge = { | |
data: [], | |
piyo () { | |
this.data.push('piyo') | |
return this | |
}, | |
get () { | |
return this.data | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let chains = [ | |
{ | |
key: 'where', | |
args: ['form_id', formId] | |
}, | |
{ | |
key: 'where', | |
args: ['assignee_id', Number(params.assignee_id)] | |
} | |
,{ |