Skip to content

Instantly share code, notes, and snippets.

@squarednob
squarednob / D3_CPI_JP_core-corecore.html
Last active Oct 1, 2015
D3 plot for Japanese CPI of core and corecore.
View D3_CPI_JP_core-corecore.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
.axis text {
font: 15px sans-serif;
}
@squarednob
squarednob / addUVsphere_on_curves2_fit_curvesize1_test3_functionize1.py
Last active Aug 29, 2015
Blender script to add UVspheres along with curve's location and length.
View addUVsphere_on_curves2_fit_curvesize1_test3_functionize1.py
def addUVsphereOnCurves(number,scale=0.1):
import bpy
import mathutils
from mathutils import Vector
objectList = []
curveList = []
lengthList = []
locationList = []
@squarednob
squarednob / Obama_speech2008.txt
Last active Jan 3, 2016
Electrophoresis emulator.
View Obama_speech2008.txt
If there is anyone out there who still doubts that America is a place where all things are possible; who still wonders if the dream of our founders is alive in our time; who still questions the power of our democracy, tonight is your answer.
It’s the answer told by lines that stretched around schools and churches in numbers this nation has never seen; by people who waited three hours and four hours, many for the very first time in their lives, because they believed that this time must be different; that their voice could be that difference.
It’s the answer spoken by young and old, rich and poor, Democrat and Republican, black, white, Latino, Asian, Native American, gay, straight, disabled and not disabled – Americans who sent a message to the world that we have never been a collection of Red States and Blue States: we are, and always will be, the United States of America.
It’s the answer that led those who have been told for so long by so many to be cynical, and fearful, and doubtful of what we can achieve
View Parse csv , json to D3 format
#1 d3.csv to [{x:~},{y:~}]
var makeData = function(d,country){
var list = [];
d.forEach(function(datum){
var obj = {};
obj["x"]= parseInt(datum.id);
obj["y"] = parseInt(datum[country]);
@squarednob
squarednob / 1D3_shapes_snipets1
Last active Dec 30, 2015
1D3_shapes_snipets1 // #1 #2 map_change coordinates into x,y by projection([lon,lat]) ; #3 map_template ; #4 arcテンプレート ; #5 パイテンプレート ; #6 treeテンプレート 2D3_shapes_snipets2 // #1 パックテンプレート ; #2 パックjsonテンプレート; #3 バブルテンプレート ; #4 バブルjsonテンプレート #5 ラインテンプレート; #6 エリアテンプレート ; #7 シンボルテンプレート 3D3_forcelayout_template 4D3_forcelayout_json 5D3_display_utirity /…
View 1D3_shapes_snipets1
#1
#2 map_change coordinates into x,y by projection([lon,lat])
var coordinates = projection([mylon, mylat]);
map.append('svg:circle')
.attr('cx', coordinates[0])
.attr('cy', coordinates[1])
.attr('r', 5);
@squarednob
squarednob / Japan_geojson_index.html
Last active Dec 30, 2015 — forked from minikomi/index.html
Japan's geojson and D3 code.
View Japan_geojson_index.html
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="http://d3js.org/d3.v2.min.js?2.10.0"></script>
<script>
var width = 960,
height = 700;
var svg = d3.select("body").append("svg")
@squarednob
squarednob / Geocode
Last active Dec 30, 2015
座標情報取得
View Geocode
#1Get coorinate using pygeocoder and googlemap API throuth place data in Japaneese.
#pygeopicker.py
# -*- coding: utf-8 -*-
from pygeocoder import Geocoder
import unicodecsv
def pick(query):
print "start"
@squarednob
squarednob / python unicode-csv
Created Dec 3, 2013
pythonで日本語csvを読み込む問題。
View python unicode-csv
#1 日本語のcsvファイルを読み込むには、unicodecsvを使う。
#これはcsvを読み込むときにutf-8化した後、出力でunicode化してくれるもの。
#目的のcsvをメモ等などで、utf-8で保存した後、以下で読み込む。
import unicodecsv
f = open("utf30.csv","rb")
r = unicodecsv.reader(f, encoding='utf-8')
View python webscraping
#1scrapy基本
--items.py でアイテムフィールドを設定する。今回はタイトルとリンク。
from scrapy.item import Item, Field
class CraigslistSampleItem(Item):
# define the fields for your item here like:
# name = Field()
title = Field()
link = Field()
View Github tutorial
// chack if I am on master branch, and hold commited things ahead of pushing.
git status
//clone URL
git@github.com:wantanmen/Electrophoresis.D3.git
//add
git add <file>
//commit