Skip to content

Instantly share code, notes, and snippets.

💭
🚀

Kodai Nakamura kdnk

💭
🚀
Block or report user

Report or block kdnk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View to_proc.md
class Symbol
  def to_proc
    Proc.new do |obj, *args|
      obj.send self, *args
    end
  end
end
View .cvimrc
set autoupdategist
map <C-h> :execute <Delete>
map <C-a> beginningOfLine
map <C-u> scrollPageUp
map <C-d> scrollPageDown
map u lastClosedTab
iunmap <C-k>
View Script_for_Duo.sh
declare -i i=1
for source in $(ls *mp3); do
n=${source%%.mp3}
mp3splt -o '@a-@t' -d ho/ -c ~/Desktop/EK_DU30F_20110614/du_${i}.cue $source
i=$((i + 1))
done
View memo_fibonacci.js
let count = 0
let memo = [1, 1]
main()
function main () {
let a = []
for (let i = 0; i < 20; i++) {
a.push(fibonacci(i))
}
console.log('count ', count)
View straight_insertion_selection.js
main()
function main () {
// let arr = [5, 8, 4, 2, 6, 1, 3, 9]
let arr = [6, 4, 1, 7, 3, 9, 8]
printArray(arr)
straightInsertionSort(arr, arr.length)
printArray(arr)
View fibonacci.js
main()
function main () {
let a = []
for (let i = 0; i < 20; i++) {
a.push(fibonacci(i))
}
console.log(a.join(' '))
}
View binary_search.js
main()
function main () {
let a = [5, 7, 15, 28, 29, 31, 39, 58, 68, 70, 95]
const key = 39
const index = binarySearch(a, a.length - 1, key)
console.log('index ', index)
}
function binarySearch (a, n, key) {
View straight_selection_sort.js
main()
function main () {
let arr = [5, 8, 4, 2, 6, 1, 3, 9]
printArray(arr)
straightSelectionSort(arr, arr.length)
printArray(arr)
}
function straightSelectionSort (a, n) {
View buble_sort.js
main()
function main () {
let arr = [5, 8, 4, 2, 6, 1, 3, 9]
printArray(arr)
bubleSort(arr, arr.length)
printArray(arr)
}
function swap (a, idx1, idx2) {
View quick_sort.js
main()
function main () {
let arr = [5, 8, 4, 2, 6, 1, 3, 9]
console.log('original: ')
printArray(arr)
quickSort(arr, 0, arr.length - 1)
}
function swap (a, idx1, idx2) {
You can’t perform that action at this time.