Skip to content

Instantly share code, notes, and snippets.

@kig
kig / workcrew.js
Created September 2, 2011 11:03
WorkCrew - a WebWorker work queue library
/*
WorkCrew - a WebWorker work queue library
Usage:
// Create an 8 worker pool using worker.js.
var crew = new WorkCrew('worker.js', 8);
// Do something whenever a job is completed.
// The result object structure is
@madankumarpc
madankumarpc / minimal3.html
Created July 27, 2012 15:50
Css examples for table
<html>
<style>
#ver-minimalist
{
font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-
Serif;
font-size: 12px;
margin: 45px;
width: 480px;
@JeffreyWay
JeffreyWay / set-value.md
Created July 28, 2012 19:09
PHP: Set value if not exist

You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:

name = name || 'joe';

This is quite common and very helpful. Another option is to do:

name || (name = 'joe');
@kenjiskywalker
kenjiskywalker / nginx_try_files_memo.md
Last active April 13, 2024 03:00
nginxのtry_filesの動作の確認

nginx config

nginx.conf

server {
    listen 80;
    server_name example.com;
    root /var/www/html/;
    index index.html;
    access_log /var/log/nginx/access_log hogehoge;
@hirak
hirak / file0.php
Created March 7, 2013 16:27
PHPで列挙型(enum)を作る ref: http://qiita.com/items/71e385b56dcaa37629fe
<?php
abstract class Enum
{
private $scalar;
function __construct($value)
{
$ref = new ReflectionObject($this);
$consts = $ref->getConstants();
if (! in_array($value, $consts, true)) {
@j5ik2o
j5ik2o / gist:5682650
Last active October 5, 2023 05:22
集約ってどんなもの?

グローバルな識別子を持つエンティティが集約になります。

ドメインモデル

  • 売上(Sale)
  • 売上明細(SaleDetail)

コード例

実装を書いてないメソッドもあるけど、適当に脳内でイメージしてね。

ドメイン層

@jmblog
jmblog / gist:6077993
Last active November 22, 2021 08:37
所得税と住民税の計算方法

所得税(国税)

所得税の計算方法

所得税額 = (所得金額(A) - 所得控除額(B)) × 税率 - 税額控除額(C)

  • 「所得金額(A)- 所得控除額(B)」は 課税所得金額 といい、1,000円未満の端数を切り捨てる。

所得税の税率

@nulltask
nulltask / 20150114-introduction-of-handy-library-for-web-workers.md
Last active May 4, 2020 11:38
Web Worker をちょっと便利にするライブラリのご紹介
@irazasyed
irazasyed / manage-etc-hosts.sh
Created March 7, 2015 09:16
Bash Script to Manage /etc/hosts file for adding/removing hostnames.
#!/bin/sh
# PATH TO YOUR HOSTS FILE
ETC_HOSTS=/etc/hosts
# DEFAULT IP FOR HOSTNAME
IP="127.0.0.1"
# Hostname to add/remove.
HOSTNAME=$1
@mandiwise
mandiwise / Update remote repo
Last active March 22, 2025 05:41
Transfer repo from Bitbucket to Github
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
$ cd $HOME/Code/repo-directory
$ git remote rename origin bitbucket
$ git remote add origin https://github.com/mandiwise/awesome-new-repo.git
$ git push origin master
$ git remote rm bitbucket