Skip to content

Instantly share code, notes, and snippets.

kuroneko46

Block or report user

Report or block kuroneko46

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
@kuroneko46
kuroneko46 / pagination.js
Last active Jun 24, 2019
Javascript Create Pagination HTML sample. (fixed page length.)
View pagination.js
function pagination(opt) {
const def = {
link: '/',
current: 1,
perPage: 5,
total: 1,
viewPageNum: 9,
query: {},
}
const options = Object.assign(def, opt);
View createimage.js
const fs = require('fs')
const { createCanvas } = require('canvas')
// キャンバスの作成
const canvas = createCanvas(200, 40)
const ctx = canvas.getContext('2d')
// 描画(今回は文字)
ctx.font = '16pt setofont'
ctx.fillStyle = 'white'
View StringData.cs
using UnityEngine;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
/// <summary>
/// 文字リソースを取得するためのクラスです。
/// </summary>
public class StringData {
View clickhandler.js
// bad case : when clicked, i is 5 always.
for(var i = 0; i < 5; i++ ) {
$(node).append( $( '<a>' + ( i + 1 ) + '</a>' ).click( function(){ alert( 'i is' + i ); } ) );
}
// fixed
for(var i = 0; i < 5; i++ ) {
(function(i){
$(node).append( $( '<a>' + ( i + 1 ) + '</a>' ).click( function(){ alert( 'i is' + i ); } ) );
})(i);
View black_white.rb
def black_white(n)
s = ''
n.times do |i|
n.times do |j|
s += (i + j).even? ? '' : ''
end
s += "\n"
end
s
end
You can’t perform that action at this time.