Skip to content

Instantly share code, notes, and snippets.

@wazum
wazum / aspect_ratio.php
Last active October 26, 2023 13:41
PHP Calculate aspect ratio from width and height
<?php
function getAspectRatio(int $width, int $height)
{
// search for greatest common divisor
$greatestCommonDivisor = static function($width, $height) use (&$greatestCommonDivisor) {
return ($width % $height) ? $greatestCommonDivisor($height, $width % $height) : $height;
};
$divisor = $greatestCommonDivisor($width, $height);
@Sacristan
Sacristan / push_commits_by_chunks.sh
Last active June 3, 2024 12:54
Push commits by chunks
REMOTE=origin
BRANCH=$(git rev-parse --abbrev-ref HEAD)
BATCH_SIZE=10
# check if the branch exists on the remote
# if git show-ref --quiet --verify refs/remotes/$REMOTE/$BRANCH; then
# # if so, only push the commits that are not on the remote already
# range=$REMOTE/$BRANCH..HEAD
# else
# # else push all the commits
@dev-hermes
dev-hermes / atom-shortcuts.md
Created March 31, 2016 08:01
Personal Atom Editor Shortcuts

Atom 에디터 단축키 (Windows 기준)

Editor

  • Ctrl + Shift + P: 커맨드 팔레트 열기
  • Ctrl + ,: 설정 뷰
  • Ctrl + .: 키 바인딩 보기 (단축키 작동 현황 보기)
  • Ctrl + K > 방향키: 패널 나누기
  • Ctrl + K > Ctrl + 방향키: 패널 전환
  • Ctrl + W: 창(패널) 닫기
@ihoneymon
ihoneymon / how-to-write-by-markdown.md
Last active July 2, 2024 17:40
마크다운(Markdown) 사용법

[공통] 마크다운 markdown 작성법

영어지만, 조금 더 상세하게 마크다운 사용법을 안내하고 있는
"Markdown Guide (https://www.markdownguide.org/)" 를 보시는 것을 추천합니다. ^^

아, 그리고 마크다운만으로 표현이 부족하다고 느끼신다면, HTML 태그를 활용하시는 것도 좋습니다.

1. 마크다운에 관하여

@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@alfonsfoubert
alfonsfoubert / strtotime.js
Created October 4, 2013 16:21
PHP strtotime function in javascript
/**
* Convert string representation of date and time to a timestamp
*
* @param text string modification
* @param now date (optional) origin date
*
* @return date or null
*
* note 1: Examples all have a fixed timestamp to prevent tests to fail because of variable time(zones)
*
@hofmannsven
hofmannsven / README.md
Last active July 3, 2024 09:53
Git CLI Cheatsheet
@iros
iros / API.md
Created August 22, 2012 14:42
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method: