Skip to content

Instantly share code, notes, and snippets.

@letitride
letitride / backtrack.php
Created February 28, 2020 12:16
深さ優先探索用のarrayノードを作成
<?php
// Your code here!
$num_list = array( 5, 20, 22, 35, 64, 71 );
//$num_list = array( 5, 20, 22, 35 );
$tree = array();
function search( $num_list, &$tree, $index ){
$arrayCount = count( $num_list );
//底まで探索
if( !array_key_exists( $index+1, $num_list ) ){
return array( $num_list[$index] );
@letitride
letitride / canvas.html
Created February 19, 2020 00:26
HTML canvasの塗り潰した割合を求める
Filled: <span id="filled"></span>/<span id="area"></span> (<span id="pct"></span>%)
<canvas width="800" height="600"></canvas>
FROM hseeberger/scala-sbt:8u222_1.3.7_2.12.10
WORKDIR /app
function array_filter_recursive($input)
{
foreach ($input as &$value) {
if (is_array($value)) {
$value = array_filter_recursive($value);
}
}
return array_filter($input);
}
<?php
class CheckDigitUtility extends AbstractUtility
{
static public function mod10( $value, $weight = 3 )
{
$length = strlen( $value );
$v = strrev( $value );
$sum = 0;
$ openssl pkcs12 -export -in pub.cer -inkey secret.key -out product.pfx
<?php
class SQLBuilder {
private $_select = array();
private $_from = array();
private $_where = array();
private $_order = array();
private $_group = array();
private $_having = null;
<?php
class APNSUtility
{
private $_certfile;
private $_message;
private $_priority;
private $_apns_server;
private $_debug = false;
<?php
require "../system/core/framework/lib/super.php";
require "../classes/utilities/CsvUtility.php";
$old_file = "/home/remote/old.csv";
$new_file = "/home/remote/new.csv";
$old_only = array();
$new_record_list = csv_file_to_array( $new_file );
@letitride
letitride / ViewController.h
Last active December 24, 2015 01:19
iphoneアプリ WebViewのcookie共有テスト
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIWebView *webView;
@property (weak, nonatomic) IBOutlet UILabel *topLabel;
- (IBAction)startView:(UIButton *)sender;
- (IBAction)endView:(UIButton *)sender;
@property (weak, nonatomic) IBOutlet UIWebView *webView_A;
- (IBAction)startView_A:(UIButton *)sender;