Skip to content

Instantly share code, notes, and snippets.

@Sankame
Sankame / gist:4196588
Created Dec 3, 2012
ruby, gems and jekyll install memo
View gist:4196588
###check if ruby is installed?
rpm -q ruby
###install ruby
yum install ruby ruby-devel rdoc irb
###install ruby gems
wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
tar xzf rubygems-1.3.5.tgz
@Sankame
Sankame / test_viaIsset.php
Last active Aug 6, 2016
[isset通過処理] 値を取り出す際のissetによる条件分岐を省略する。
View test_viaIsset.php
<?php
$array = array();
$test = '';
// 配列の要素は取り出す前にissetで確認しないとPHP Noticeが出てしまう…
if( isset( $array['key2'] ) ){
$test = $array['key2'];
}
@Sankame
Sankame / completeAuthorization.php
Last active Feb 21, 2018
fitbit API sample for PHP
View completeAuthorization.php
<?php
// Base URL
$baseUrl = 'https://api.fitbit.com';
// Request token path
$req_url = $baseUrl . '/oauth/request_token';
// Authorization path
//【変更】
//$authurl = $baseUrl . '/oauth/authorize';
@Sankame
Sankame / mecabtest.php
Last active May 4, 2017
phpからmecabを利用する。
View mecabtest.php
<?php
dl('mecab.so');
$t = new MeCab_Tagger();
$str = 'すもももももももものうち';
echo $t->parse($str);
@Sankame
Sankame / require_autoload.php
Created May 18, 2014
phalconでautoloadを読み込む。
View require_autoload.php
<?php
require './vendor/autoload.php';
@Sankame
Sankame / php_debugbar.volt
Created May 18, 2014
phalconのviewテンプレートvoltにphp debugbarを埋め込む。
View php_debugbar.volt
<html>
<head>
<?php echo $debugbarHeader ?>
</head>
<body>
<?php echo $debugbarBody ?>
</body>
</html>
@Sankame
Sankame / seleniumtest.rb
Last active May 4, 2017
Selenium WebDriverを起動するサンプルプログラム
View seleniumtest.rb
#!/usr/bin/ruby
require 'rubygems'
require 'selenium-webdriver'
#driver = Selenium::WebDriver.for :ie
caps = Selenium::WebDriver::Remote::Capabilities.internet_explorer(
:javascript_enabled => true)
@Sankame
Sankame / seleniumtest_4445.rb
Last active May 4, 2017
Selenium WebDriverを使ってブラウザ起動するプログラム
View seleniumtest_4445.rb
#!/usr/bin/ruby
require 'rubygems'
require 'selenium-webdriver'
#driver = Selenium::WebDriver.for :ie
caps = Selenium::WebDriver::Remote::Capabilities.internet_explorer(
:javascript_enabled => true)
driver = Selenium::WebDriver.for(:remote
View ajax-test.js
/** Ajax POSTテスト */
function ajaxTest(){
$.ajax({
type : "POST",
url : "/test/",
data : {"test":"hoge"},
scriptCharset : "UTF-8",
success : function(msg, status){
var json = eval(msg);
You can’t perform that action at this time.