This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public partial class MainForm : Form { | |
// Avoids dead lock problem when closed in invoking | |
private bool invoking = false; | |
private bool closeRequested = false; | |
public new object Invoke(Delegate program) { | |
object ret = null; | |
if (!closeRequested) { | |
invoking = true; | |
try { | |
ret = base.Invoke(program); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends Activity { | |
// @see main_activity.xml | |
ViewGroup linearLayout1 = null; | |
Button button1 = null; | |
Button button2 = null; | |
Button button3 = null; | |
Button button4 = null; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
template<class StorageType> | |
void split( | |
char c, const std::string& s, | |
StorageType& result) | |
{ | |
size_t pos, offset = 0; | |
while (true) { | |
pos = s.find(c, offset); | |
if (pos == std::string::npos) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <deque> | |
template<class InputType, class InnerAvgType=double, | |
class AvgType=InputType> | |
class MovingAverage { | |
int average_count; | |
std::deque<InputType> buffer; | |
InnerAvgType average; | |
public: | |
MovingAverage() : average_count(1), average(0) { } | |
MovingAverage(int average_count) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<class InputType, class InnerAvgType=double, class AvgType=InputType> | |
class LongAverage { | |
int average_count; | |
int buffer_count; | |
InnerAvgType average; | |
public: | |
LongAverage() : average_count(100000), buffer_count(0), average(0) { } | |
LongAverage(int average_count) : average_count(average_count), buffer_count(0), average(0) | |
{ | |
assert(average_count > 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <windows.h> | |
#ifdef _DEBUG | |
#include <deque> | |
#endif | |
class TimerThread { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include "windows.h" | |
#include <string> | |
class Sound | |
{ | |
public: | |
Sound(); | |
Sound(const std::string& filename); | |
~Sound(); | |
bool Load(const std::string& filename); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- load a gist directly by using RawGit --> | |
<script | |
type="text/javascript" | |
src="https://cdn.rawgit.com/takamin/d39bf8ccff805baecb1b/raw/faf22f4f507673ce3143b82ee842dcf5b2130c2a/wait_jquery.js" | |
></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 気象庁のサイトから都府県・地方データの一覧を得る | |
* @return array ('name'=>名称,'prec_no'=>都府県・地方No) | |
*/ | |
function jma_get_prec_list() { | |
$url = "http://www.data.jma.go.jp/obd/stats/etrn/select/prefecture00.php"; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* timespinner "hh:mm" | |
*/ | |
$.widget( "ui.timespinner", $.ui.spinner, { | |
options: { step: 1, page: 1 }, | |
_parse: function( value ) { | |
if ( typeof value === "string" ) { | |
if ( Number( value ) == value ) { | |
return Number( value ); | |
} |
OlderNewer