Skip to content

Instantly share code, notes, and snippets.

var CommentBox = React.createClass({
loadCommentsFromServer: function() {
$.ajax({
url: this.props.url,
dataType: 'json',
success: function(data) {
this.setState({data: data});
}.bind(this),
error: function(xhr, status, err) {
console.error(this.props.url, status, err.toString());
@syon
syon / screenshot.js
Created April 1, 2015 03:12
CasperJS sample
var props = {
// Chrome
pc:{
ua: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36",
//viewport: { width: 2560, height: 1440 }
viewport: { width: 640, height: 480 }
},
// iPhone 5, iOS 8.0.2
mobile: {
ua: "Mozilla/5.0 (iPhone; CPU iPhone OS 8_0_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12A405 Safari/600.1.4",
@syon
syon / materialcolors.rb
Created May 15, 2015 10:35
Generate Material Colors PNG with ImageMagick
file = File.open('materialcolors.txt')
file.each_line do |hex|
hex.gsub! "\n", ""
cmd = "convert -size 15x15 xc:##{hex} result/#{hex}.png"
system(cmd)
end
@syon
syon / cVimrc
Last active May 31, 2020 07:33
syon / cVimrc
set scalehints
set smoothscroll
let scrollduration = 300
let hintcharacters = "asdgwetcvb"
copyThisPageTitle() -> {{
var text = document.title || (document.querySelector("title") || {}).innerText || '';
RUNTIME('copy', { text: text });
Status.setMessage(text, 2);
}}

Windows settings

Apps

Keyboard

@syon
syon / 0_reuse_code.js
Created June 18, 2016 06:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@syon
syon / webpack.config.js
Created December 5, 2016 16:28
SPA ではない Webpack 設定サンプル
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
context: __dirname + '/src',
entry: {
javascript: './app.js',
},
output: {

Document Title (Level 0)

Level 1 Section Title

Level 2 Section Title

Level 3 Section Title

Level 4 Section Title
@syon
syon / ogp_print.js
Created May 1, 2017 03:28
OGP with cheerio on Node.js (Sample)
const fetch = require('node-fetch');
const cheerio = require('cheerio');
urls = []
urls.push('http://qiita.com/horike37/items/b295a91908fcfd4033a2')
urls.push('http://qiita.com/ryo0301/items/7f9fd8024987526cbc30')
urls.push('http://inokara.hateblo.jp/entry/2017/04/30/092304')
urls.push('https://togetter.com/li/1105672')
urls.push('https://allabout.co.jp/gm/gc/469010/')
urls.push('http://anond.hatelabo.jp/20170429110724')
@syon
syon / cloudSettings
Last active November 18, 2018 15:12
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-11-18T15:12:33.419Z","extensionVersion":"v3.2.0"}