Skip to content

Instantly share code, notes, and snippets.

View kkawamura's full-sized avatar

kkawamura kkawamura

  • Self-Employed
  • Kanagawa, Japan
View GitHub Profile
@kkawamura
kkawamura / gist:4942700
Created February 13, 2013 06:31
nl2br for rails helper
def nl2br(str)
str.gsub(/\r\n|\r|\n/, "<br />")
end
@kkawamura
kkawamura / modal.html
Created February 13, 2013 10:46
modal sample
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap 101 Template</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<style type="text/css">
body .modal {
width: 90%; /* desired relative width */

Denki Groove "Tour Panda" @ Zepp Diver City Tokyo , 2012-03-12 19:00-21:30

test2

  • test

setlist

  1. The Big Shirts
@kkawamura
kkawamura / test.js
Last active December 18, 2015 02:39
(function(){
function number_format(num){
return num.toString().replace(/([\d]+?)(?=(?:\d{3})+$)/g, function(t){ return t + ','; });
}
function sum_history(){
var elements = document.getElementsByClassName('itemPriceAmount');
var total = 0;
for(var i=0; i<elements.length; i++){
var str = "19,000円";
now = str.match(/^([0-9,]*)円$/)[1];
now = now.replace(/\,/,"");
now = parseInt(now);
price = 10;
alert(now+price);
alert(now);
@kkawamura
kkawamura / test2.js
Last active December 18, 2015 02:49
(function(){
var total = 0;
var year = '2012';
function init(num) {
num = (typeof num !== 'number' ? 0 : num);
if(num === 0) {
$('<div/>').css({
position: 'fixed',
left: 0,
top: 0,
(function(){
var total = 0;
var year = '2012';
function init(num) {
num = (typeof num !== 'number' ? 0 : num);
if(num === 0) {
$('<div/>').css({
position: 'fixed',
left: 0,
top: 0,
(function(){
var total = 0;
var year = '2012';
function init(num) {
num = (typeof num !== 'number' ? 0 : num);
if(num === 0) {
$('<div/>').css({
position: 'fixed',
left: 0,
top: 0,
javascript:(function(){var d=document;var s=d.createElement('script');s.src='https://gist.github.com/kkawamura/5713927/raw/76c466ce3e1b1f4cf0f53d822306450ff8066c5f/test2.js'; d.body.appendChild(s)})();
@kkawamura
kkawamura / date.sh
Created June 14, 2013 07:34
generate date list by shellscript
#!/bin/sh
start_date="20120601"
end_date="20120610"
i=0
while [ 1 ] ;do
now=`date +%Y%m%d -d "$start_date + $i days"`
echo $now
# command