Skip to content

Instantly share code, notes, and snippets.

Avatar
🐍
Dance

elzup elzup

🐍
Dance
View GitHub Profile
@elzup
elzup / gist:8080703
Created Dec 22, 2013
Rubyの練習 完全数をコンソール出力
View gist:8080703
MAX = 1000
def sum(*list)
s = 0
if list.size == 1 then
return list
end
for val in list do
s += val
end
View streamingtest.php
<?php
require_once('./lib/userdata.php');
$consumer_key = $userdata->twitter_consumer_key;
$consumer_secret = $userdata->twitter_consumer_key_secret;
$oauth_token = $userdata->twitter_access_token;
$oauth_token_secret = $userdata->twitter_access_token_secret;
$url = 'https://userstream.twitter.com/1.1/user.json';
$method = 'GET';
View index.php
<?php
// Tumblrに投稿したTagの一括置き換えをする
/* action config */
// 置換前の文字列
$search = '-';
// 置換後の文字列
$replace = ' ';
// 完全一致のみ置換 -> TRUE, 部分置換 -> FALSE
$is_compmatch = FALSE;
View index.html
<!DOCTYPE html>
<meta charset="UTF-8">
<title>css モンスターボール</title>
<style>
.monsterball-wrap {
height: 140px;
width: 140px;
float: left;
border: solid;
View rand_c.php
<?php
define('CIRCLE_D', 36);
for ($k = 0; $k < 100; $k++):
list($px, $py) = get_rand_circle(CIRCLE_D / 2);
for ($i = 0; $i < CIRCLE_D;$i++) {
for ($j = 0; $j < CIRCLE_D;$j++) {
if ($i == $py && $j == $px) {
echo '=';
View fizzbuzz.php
<?php
list($f,$b)=str_split($_='fibu',sqrt(strlen($_)));
preg_match("#(".str_repeat('(.{4})',2).")#","{$f}zz{$b}zz",${"'"});
while(@$__!==@${0}?$_--+--$__*@${''}:$_=$__=ord(@c)):?><?=!($k=++$__-$_).(@${'\''}[(4-!($k%15)-!($k%3)*2-!($k%5))]?:$k)?>
<?php endwhile ?>
View eject.php
<?php
require_once('keys.php');
/**
keys.phpを設置して twitter tokenなどを用意しておく
define('CONSUMER_KEY' , '*********');
define('CONSUMER_SECRET' , '*********');
define('OAUTH_TOKEN' , '***-******');
define('OAUTH_TOKEN_SECRET' , '*********');
*
*/
View index.html
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="style.css" type="text/css" media="screen" charset="utf-8" />
</head>
<body>
<div class="case">
<div class="pockey c1"> <div class="stick"></div> <div class="chocolate"></div></div>
View style.css
.case {
background: red;
height: 600px;
width: 400px;
margin: 10px;
padding: 10px;
border: solid 1px black;
}
.pockey {
View 14せいです><
for (var n = 2; n < 20; n++) {
print("私は" + n + "FI生" + ((n == (14).toString(n)) ? "です" : "じゃありません"));
}
You can’t perform that action at this time.