Skip to content

Instantly share code, notes, and snippets.

View peace098beat's full-sized avatar

Tomoyuki Nohara peace098beat

View GitHub Profile
/*Complex Selector Example*/
QLineEdit { color: red }
QLineEdit[readOnly="true"] { color: gray }
QDialog QLineEdit { color: brown }
/*Customizing QAbstractScrollArea*/
QTextEdit, QListView {
background-color: white;
background-image: url(draft.png);
background-attachment: scroll; /*If the background-image is to be fixed with the viewport: scroll or fixed*/
}
@peace098beat
peace098beat / config_parser.py
Created August 11, 2016 05:47
[Python] Config Parser
def parse_config(config_path):
# Parse Config
# ============
config = ConfigParser.RawConfigParser()
config.read(config_path)
config_dict = dict()
for section in config.sections():
config_dict[section] = dict()
def cartesian_product(X):
"""直積を求める
直積とは A={a, b, c}, B={d, e}のような2つの集合が与えられたとすると
A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}
"""
import itertools
Y = list(itertools.product(*X))
# >> [(11, 21, 31), (11, 21, 32), (11, 21, 33), (11, 22, 31), (11, 22, 32), (11, 22, 33),
@peace098beat
peace098beat / pyside.py
Created August 10, 2016 00:11
[pyside] ウィンドウスタイル
#! coding:utf-8
"""
Created by 0160929 on 2016/08/10 8:11
"""
import os
import sys
from PySide.QtGui import *
from PySide.QtCore import *
@peace098beat
peace098beat / spotify_bs.py
Created July 19, 2016 02:30
BS4スクレイピング
#!coding:utf-8
"""
spotify_bs.py
https://spotifycharts.com/regionalから小さいサムネイル画像の取得・保存するスクリプト
もじBeautifullSoupがなければインストールしてください
pip install bs4 # ???
@peace098beat
peace098beat / index.html
Created July 17, 2016 15:07
[Create.js]
<html>
<head>
<script src="https://code.createjs.com/easeljs-0.8.2.min.js"></script>
<script src="https://code.createjs.com/tweenjs-0.6.2.min.js"></script>
<script src="https://code.createjs.com/preloadjs-0.6.2.min.js"></script>
</head>
<body onload="init();">
@peace098beat
peace098beat / ODE
Created July 17, 2016 09:50
るんげくった
document.getElementById('helloWorld').innerHTML = 'Hello, World!';
var g = 9.8;
var L = 9.8;
var w = 100;
var PI = 3.14159265;
function dprint(s){
document.getElementById('helloWorld').innerHTML += "<p>" +s+"</p>\n";
}
@peace098beat
peace098beat / Color.ViewModel.js
Last active July 14, 2016 00:11
[ColorPallete][Knockout.js]
window.onload = function() {
function ColorModel(code) {
var self = this;
self.code = ko.observable(code);
}
// This is a simple *viewmodel* - JavaScript that defines the data and behavior of your UI
function ColorViewModel() {
var self = this;
@peace098beat
peace098beat / absolute.html
Created July 7, 2016 08:46
[CSS] Absoluteレイアウト
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- <meta http-equiv="X-UA-Compatible" content="IE=edge"> -->
<!-- <meta name="viewport" content="width=device-width, initial-scale=1"> -->
<title>Type it Yourself</title>
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="./bootstrap/css/bootstrap.min.css">
@peace098beat
peace098beat / inde.html
Created July 4, 2016 09:12
[Knockout.js] Works Page
<!DOCTYPE html>
<html>
<head>
<title>Knockout.js</title>
<link rel="stylesheet" type="text/css" href="./bootstrap/css/bootstrap.min.css">
<script src="./js/jquery.min.js"></script>
<script src="./bootstrap/js/bootstrap.min.js"></script>
<script src="./js/knockout.min.js"></script>
<script src="./js/user-script.js"></script>