Skip to content

Instantly share code, notes, and snippets.

View momota10s's full-sized avatar
🎯
Focusing

Momota Sasaki momota10s

🎯
Focusing
View GitHub Profile
@momota10s
momota10s / img_crawling.php
Created November 12, 2014 11:45
ゲームアプリのキャラクター情報を収集するコード
<?php
//外部ファイル(goutte.phar)の呼び出し
require_once 'goutte.phar';
use Goutte\Client;
//Goutteオブジェクトの生成
$client = new Client();
//配列(URLデータ)の宣言
@momota10s
momota10s / streaming.py
Created January 11, 2015 03:17
twitter Streaming APIを用いてsampleを取得する為のスクリプトです.ライブラリにtweepyを使っています.基本的にはexampleのデータですが,きれいなjsonが取得出来ない為少し改良しました.
#!/usr/bin/python
# -*- coding: utf-8 -*-
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
#key
consumer_key = ''
consumer_secret = ''
@momota10s
momota10s / bibsample1.bib
Created January 30, 2015 11:30
TeXでWebサイトを参考した時のbibの書き方
@misc{soumu,
author = {総務省},
title = {平成25年通信利用動向調査の結果},
note = {\url{http://www.soumu.go.jp/menu_news/s-news/01tsushin02_02000072.html}},
year = {2014}
}
@momota10s
momota10s / sed.txt
Created February 1, 2015 09:00
先頭の行に任意の文字列を追加するコマンド
sed -i '' '1s/^/test0/' test.txt
@momota10s
momota10s / board.php
Created March 10, 2015 12:43
簡易掲示板のformです。codeigniterとbootstrapを使用しています。また、非同期通信によってlikeボタンと投稿ボタンによるsubmitでリロードをしない実装となっています。
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
?>
<?php
$username = array(
'name' => 'name',
'value' => set_value('name'),
'size' => '25',
'type' => 'text',
@momota10s
momota10s / phantom-centos.txt
Created March 17, 2015 22:23
PhantomJS1.9.8をCentOSにインストールする
$ su
$ yum install gcc gcc-c++ make git openssl-devel freetype-devel fontconfig-devel
$ cd /usr/local/src/
$ wget https://phantomjs.googlecode.com/files/phantomjs-1.9.8-linux-x86_64.tar.bz2
$ tar jxfv phantomjs-1.9.8-linux-x86_64.tar.bz2
$ cp phantomjs-1.9.8-linux-x86_64/bin/phantomjs /usr/bin/
@momota10s
momota10s / index.html
Created April 29, 2015 04:35
Hello React
<html>
<head>
<script src="build/react.js"></script>
<script src="build/JSXTransformer.js"></script>
</head>
<body>
<div id="container"></div>
<script type="text/jsx">
var App = React.createClass({
render: function(){
@momota10s
momota10s / week.php
Last active August 29, 2015 14:21
曜日を色付きで返すメソッド
<?php
/**
** 曜日を色付きで返す
*/
public static function getDayOfWeek($date){
$week = array("日", "月", "火", "水", "木", "金", "土");
$w = date("w", strtotime($date));
print($date);
if($w == 0){
print("<FONT COLOR=\"RED\">(".$week[$w].")");
@momota10s
momota10s / week.html
Created May 19, 2015 13:15
休日の曜日の文字に色をつける
<html>
<?php $week = array("日", "月", "火", "水", "木", "金", "土"); ?>
<?php $w = date("w", strtotime($date)); ?>
<?php if($w == 0): ?>
<p><?php echo $date; ?><font color="#ff0000">(<?php echo $week[$w]; ?>)</p>
<?php elseif($w == 6): ?>
<p><?php echo $date; ?><font color="#0000ff">(<?php echo $week[$w]; ?>)</p>
<?php else: ?>
<p><?php echo $date; ?>(<?php echo $week[$w]; ?>)</p>
@momota10s
momota10s / foundation.js
Last active August 29, 2015 14:21
JavaScriptの基礎
//var
var example = 'some string';
//console.log
console.log(example);
//length
console.log(example.length);
//random number create