Skip to content

Instantly share code, notes, and snippets.

View ujiro99's full-sized avatar

ujiro99 ujiro99

  • japan
View GitHub Profile
@dtoma
dtoma / Makefile
Last active November 5, 2022 14:46
makefile rules to check style using clang-format
style:
@for src in $(SOURCES) ; do \
echo "Formatting $$src..." ; \
clang-format -i "$(SRC_DIR)/$$src" ; \
clang-tidy -checks='-*,readability-identifier-naming' \
-config="{CheckOptions: [ \
{ key: readability-identifier-naming.NamespaceCase, value: lower_case },\
{ key: readability-identifier-naming.ClassCase, value: CamelCase },\
{ key: readability-identifier-naming.StructCase, value: CamelCase },\
{ key: readability-identifier-naming.FunctionCase, value: camelBack },\
@hyamamoto
hyamamoto / string.hashcode.js
Created September 30, 2016 07:19
JavaScript Implementation of String.hashCode() .
/**
* Returns a hash code for a string.
* (Compatible to Java's String.hashCode())
*
* The hash code for a string object is computed as
* s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
* using number arithmetic, where s[i] is the i th character
* of the given string, n is the length of the string,
* and ^ indicates exponentiation.
* (The hash value of the empty string is zero.)
@mono0926
mono0926 / commit_message_example.md
Last active March 29, 2024 03:40
[転載] gitにおけるコミットログ/メッセージ例文集100
@xenozauros
xenozauros / hex2hsl.js
Last active February 19, 2024 20:22
Javascript: HEX to RGB to HSL
function hexToHSL(hex) {
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
r = parseInt(result[1], 16);
g = parseInt(result[2], 16);
b = parseInt(result[3], 16);
r /= 255, g /= 255, b /= 255;
var max = Math.max(r, g, b), min = Math.min(r, g, b);
var h, s, l = (max + min) / 2;
if(max == min){
h = s = 0; // achromatic
@rbtnn
rbtnn / gist:739a2fabf3317a95c965
Created July 1, 2015 15:07
nyagos gitブランチ補完
nyagos.completion_hook = function (c)
local bs = {
"submodules",
"add",
};
if c.text:match('^git ') then
for b in nyagos.eval('git branch'):gmatch('[^ \n*>-/]+') do
table.insert(bs, b);
end
@ujiro99
ujiro99 / bumpUp.coffee
Created February 22, 2015 02:07
選択したファイルのリビジョン番号をインクリメントし、元のファイルのバックアップを行う、秀丸ファイラ用のスクリプト
class FileOperator
# constant
BACKUP_DIR_NAME = "bak"
NO_OVERWRITE = "false"
PATH_SEPARATOR = "/"
EXTENSION_SEPARATOR = "."
REVISION_INIT = 2
# fields
@fieldoffice
fieldoffice / sass-transforms
Last active September 27, 2022 17:32
Sass Transform Mixins
// Browser Prefixes
@mixin transform($transforms) {
-webkit-transform: $transforms;
-moz-transform: $transforms;
-ms-transform: $transforms;
transform: $transforms;
}
// Rotate
@mixin rotate ($deg) {
@chris-piekarski
chris-piekarski / logcat parser
Last active May 9, 2016 23:48
Parse Android logcat file into .csv file with cols as TAGS
# Author: @c_piekarski
import optparse
import csv
import logging
import os
import datetime
import re
TAGS = ["Browser","Dalvikvm", "Zygote", "AndroidRuntime"]
SUBTAGS = [
@josephspurrier
josephspurrier / drop_encrypt.go
Last active March 24, 2020 17:48
Golang - Drag and Drop AES Encryption and Decryption
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"fmt"
"io"
"io/ioutil"
"os"
@yongkangchen
yongkangchen / atom.js
Last active September 13, 2022 13:15
boom!!! Here is a hack solution to make atom start faster. For Atom <= v0.170.0
Atom.prototype.startEditorWindow = function() {
var CommandInstaller, dimensions, maximize, resourcePath, safeMode, _ref;
_ref = this.getLoadSettings(), resourcePath = _ref.resourcePath, safeMode = _ref.safeMode;
CommandInstaller = require('./command-installer');
CommandInstaller.installAtomCommand(resourcePath, false, function(error) {
if (error != null) {
return console.warn(error.message);
}
});
CommandInstaller.installApmCommand(resourcePath, false, function(error) {