Skip to content

Instantly share code, notes, and snippets.

Yutaka Yamaguchi memolog

Block or report user

Report or block memolog

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
@memolog
memolog / karatsuba.js
Last active Jun 20, 2019
Karatsuba algorithm in JavaScript
View karatsuba.js
function add(a, b) {
a = a.toString();
b = b.toString();
const re = /^-/;
if (re.test(a) && re.test(b)) {
a = a.substring(1);
b = a.substring(1);
} else if(re.test(a)) {
a = a.substring(1);
View prism-default-a11.css.diff
--- themes/little-code-bricks/source/css/prism.css 2018-08-17 22:04:12.000000000 +0900
+++ themes/little-code-bricks/source/css/prism-default-a11.css 2018-08-17 22:05:53.000000000 +0900
@@ -71,11 +71,11 @@
.token.prolog,
.token.doctype,
.token.cdata {
- color: slategray;
+ color: #5f6d7b;
}
@memolog
memolog / prism-default-a11.css
Created Aug 17, 2018
Prism default CSS plus contrast for a11y
View prism-default-a11.css
/* PrismJS 1.9.0
http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+bash+ruby+diff+json+perl+python+jsx+scss+swift+typescript&plugins=line-numbers */
/**
* prism.js default theme plus contrast for a11y
* Based on default theme, dabblet (http://dabblet.com)
* @author Lea Verou
*/
code[class*="language-"],
pre[class*="language-"] {
View sortTest.js
function test(method, array, showArray){
let arrayLength;
if (typeof array === 'number') {
arrayLength = array;
array = [];
for (let i=0; i<arrayLength; i++) {
array.push(Math.floor(Math.random()*10000));
}
} else {
arrayLength = array.length;
View hash-table-example.js
const stringHash = require("string-hash");
module.exports = class MyHashTable {
constructor(numberOfBucket) {
this.numberOfBucket = parseInt(numberOfBucket, 10);
this.hashTable = new Array(this.numberOfBucket);
}
get(key) {
key = '' + key;
const hashTableIndex = this.getHashTableIndex(key);
@memolog
memolog / es5build.js.diff
Created May 16, 2015
ad hoc fix for es5build.js
View es5build.js.diff
diff --git a/tools/build/es5build.js b/tools/build/es5build.js
index b16f9d9..25b5ae6 100755
--- a/tools/build/es5build.js
+++ b/tools/build/es5build.js
@@ -56,7 +56,10 @@ function run(config) {
.pipe(sourcemaps.init())
.pipe(through2.obj(function(file, encoding, done) {
var self = this;
- fs.readFile(file.path.replace('.js', '.map'), function(error, buffer) {
+ var filePath = file.path.replace('.js', '.map');
@memolog
memolog / gist:7866919
Created Dec 9, 2013
local task for replacing icons and splash with prepared images.xcassets directory
View gist:7866919
module.exports = function (grunt) {
// Please see the Grunt documentation for more information regarding task
// creation: http://gruntjs.com/creating-tasks
'use strict';
grunt.registerMultiTask('useXCAssets', 'operating node-xcode', function () {
var xcode = require('xcode');
var _ = require('lodash') || grunt.util._;
var fs = require('fs');
@memolog
memolog / gist:7855866
Last active Dec 30, 2015
sample local grunt task: change project build configuration, like IPHONEOS_DEPLOYMENT_TARGET using node-xcode
View gist:7855866
module.exports = function (grunt) {
// Please see the Grunt documentation for more information regarding task
// creation: http://gruntjs.com/creating-tasks
'use strict';
grunt.registerMultiTask('nodexcode', 'operating node-xcode', function () {
var xcode = require('xcode');
var _ = require('lodash') || grunt.util._;
var fs = require('fs');
You can’t perform that action at this time.