Skip to content

Instantly share code, notes, and snippets.

View tsmsogn's full-sized avatar
:octocat:
Set your status

tsmsogn tsmsogn

:octocat:
Set your status
View GitHub Profile
@Potherca
Potherca / README.md
Last active October 20, 2023 20:40
PHP Split file with multiple classes into separate files.

Split a file with mulitple classes into separate files.

Installation

git clone git@gist.github.com:594adece80ad1e9ddbce0b207db8ed0c.git split-file
cd split-file
composer install

Usage:

@sa-nitawaki
sa-nitawaki / kana2upper.js.gs
Last active January 13, 2020 03:25
google spreadsheet で半角カナを全角カナにする関数 kana2upper() を作成
/*
How to use:
1)Create new file.
2)
*/
function kana2upper(string) {
@iben12
iben12 / 1_Laravel_state-machine.md
Last active August 12, 2023 08:36
Laravel: State-machine on Eloquent Model

Implementing State Machine On Eloquent Model*

* Update (12.09.2017): I have improved the trait so that it can be used with objects other than Eloquent Models.

Some days ago I came across a task where I needed to implement managable state for an Eloquent model. This is a common task, actually there is a mathematical model called "Finite-state Machine". The concept is that the state machine (SM) "can be in exactly one of the finite number of states at any given time". Also changing from one state to another (called transition) depends on fulfilling the conditions defined by its configuration.

Practically this means you define each state that the SM can be in and the possible transitions. To define a transition you set the states on which the transition can be applied (initial conditions) and the only state in which the SM should be after the transition.

That's the theory, let's get to the work.

@dmongeau
dmongeau / .travis.yml
Last active April 27, 2022 10:16
Example of travis configuration for Laravel Package testing (5.1 to 5.8) on multiple versions of PHP (5.5 to 7.3) with code coverage (coveralls)
language: php
cache:
directories:
- $HOME/.cache/pip
- $HOME/.composer/cache/files
php:
- 5.6
- 7.0
@damien-biasotto
damien-biasotto / docker-compose.yml
Created October 10, 2015 12:53
Croogo3 Docker
web:
image: occitech/cakephp:5-apache
ports:
- 80
links:
- db
- mail
volumes:
- .:/var/www/html
environment:
@voluntas
voluntas / mqtt.rst
Last active March 1, 2023 06:47
MQTT とはなんだったのか

MQTT とはなんだったのか

更新

2017-05-09

作者

@voluntas

バージョン

3.14

URL

http://voluntas.github.io/

MQTT をググって調べた人向け

# Constructing a maze with a clustering algorithm
# (C) Copyright H. Watanabe 2015
# Distributed under the Boost Software License, Version 1.0.
# (See copy at http://www.boost.org/LICENSE_1_0.txt)
class Maze
def initialize(s)
@lx = s
@ly = @lx*297/210
@bond_h = Array.new((@lx+1)*@ly) { false}
@bond_v = Array.new(@lx*(@ly+1)) { false}
@5000164
5000164 / autocomplete.php
Last active February 24, 2019 12:42
IDE で FuelPHP の補完を効かせるための _autocomplete.php を生成するタスク
<?php
namespace Fuel\Tasks;
/**
* @author Kenji Suzuki <https://github.com/kenjis>
* @copyright 2012 Kenji Suzuki
* @license MIT License http://www.opensource.org/licenses/mit-license.php
* @link https://github.com/kenjis/fuelphp-tools
*
@Akiyah
Akiyah / jibanyan_equation
Created November 12, 2014 00:28
jibanyan_equation
jibanyan_equation <- function(x,y) {
min(max(min(1-(x/108)^2-(y/94)^2,y),min(1-((abs(x)-119)/103)^2-((y-56)/86)^2,1-((abs(x)-15)/77)^2-((y-119)/100)^2),1-((abs(x)-42)/66)^2-(y/55)^2,min(55+y,51-abs(x),-y)),3*abs(y-100)-2*(x-75)) *
min(min(max(min(1-(x/106)^2-(y/92)^2,y),min(1-((abs(x)-119)/101)^2-((y-56)/84)^2,((abs(x)-99)/40)^2+((y-54)/86)^2-1,92-abs(x)),1-((abs(x)-42)/64)^2-(y/53)^2),min(((abs(x)-52)/26)^2+((y+28)/26)^2-1,((abs(x)-51)/13)^2+(y/13)^2-1,max(abs(x)-51,y))),abs(x/51+10/51*sin(abs(y/61.2)^(1.2)*pi*(7/2)))^(2/3)+abs(y/61.2)^(2/3)-1) *
min(1-(x/32)^2-((y+30)/32)^2,1-((abs(x)+5)/22)^2-((y-18)/22)^2) *
min(1-((abs(x)-18)/20)^2-((y+10)/20)^2,((abs(x)-20)/22)^2+((y+7)/20)^2-1) *
(1-((abs(x)-51)/11)^2-(y/11)^2)
}
x <- seq(-150, 150, length=400)
z <- outer(x,x, Vectorize(jibanyan_equation))
@b0n
b0n / gist:c438dd80b597dcd1254d
Last active August 29, 2015 14:06
Select plugin name and version from wp page or plugins
# coding: utf-8
require 'open-uri'
require 'nokogiri'
url = "http://test.localhost/abc.plugin.html"
charset = nil
html = open(url) do |f|
charset = f.charset
f.read