Skip to content

Instantly share code, notes, and snippets.

View othree's full-sized avatar
:accessibility:
On the way to refactoring

othree othree

:accessibility:
On the way to refactoring
View GitHub Profile
var T = function (id) {
var p = new Promise(function (resolve) {
setTimeout(function () {
console.log(id, 'resolved');
resolve(id);
}, Math.random()*3000);
});
return p;
var removeElements = function(head, val) {
if (head === null) { return null; }
if (head.val === val) {
return removeElements(head.next, val);
} else {
head.next = removeElements(head.next, val);
}
return head;
};
var rangeBitwiseAnd = function(m, n) {
if (m === 0) { return 0; }
if (m === n) { return m; }
var min = m;
var l2m = Math.floor(Math.log2(m)) + 1;
var l2n = Math.floor(Math.log2(n)) + 1;
if (l2m !== l2n) { return 0; }
@othree
othree / convert_textile_to_markdown.rake
Created June 4, 2015 08:25
redmine_convert_textile_to_markdown.rake
task :convert_textile_to_markdown => :environment do
require 'tempfile'
WikiContent.all.each do |wiki|
([wiki] + wiki.versions).each do |version|
textile = version.text
src = Tempfile.new('textile')
src.write(textile)
src.close
dst = Tempfile.new('markdown')
dst.close
git config --global alias.user '!f() { if [ "$1" = "360" ]; then git config user.name "othree"; git config user.email [email protected]; else git config user.name "othree"; git config user.email [email protected]; fi; }; f'
{
"celebrate":"BQADBQADhwADMqsKAuEXXyu4ilLCAg",
"busy bee":"BQADBQADogADMqsKAiykgKeu_QqfAg",
"enthusiast":"BQADBQADpAADMqsKAvrSFOHsu44HAg",
"evergreen":"BQADBQADpgADMqsKAuYN0dN0aGTUAg",
"middle manager":"BQADBQADqAADMqsKAvnjyOmGak8JAg",
"stalwart":"BQADBQADqgADMqsKAruaTkuu2qMjAg",
"wizard":"BQADBQADrAADMqsKAsOBf5BSdIygAg",
"happy":"BQADBQADrgADMqsKAk-8VDZI5syBAg",
"angry":"BQADBQADsAADMqsKAsjoJq9W1mnJAg",
{
"!name": "fetch",
"Headers": {
"!type": "fn(init?: object)",
"!doc": "Represents response/request headers, allowing you to query them and take different actions depending on the results.",
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Headers",
"prototype": {
"append": {
"!type": "fn(name: string, value: string)",
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Headers/append",
(function () {
var decode = ProtoBuf.Reflect.Message.Field.prototype.decode;
ProtoBuf.Reflect.Message.Field.prototype.decode = function () {
var value = decode.apply(this, arguments);
if (ProtoBuf.TYPES["enum"] === this.type) {
var values = this.resolvedType.children;
for (var i=0; i<values.length; i++){
if (values[i].id == value){
return values[i].name;
echo "Touch Files:"
ls `git rev-parse --show-toplevel`/tmp/*.reload
touch `ls \`git rev-parse --show-toplevel\`/tmp/*.reload`