Skip to content

Instantly share code, notes, and snippets.

View dorentus's full-sized avatar
🎲
🌎🌍🌏

ZHANG Yi dorentus

🎲
🌎🌍🌏
View GitHub Profile
@dorentus
dorentus / dart.txt
Created September 21, 2011 09:31 — forked from paulmillr/dart.md
Leaked internal google dart email
---------- Forwarded message ----------
From: Mark S. Miller <erights@google.com>
Date: Tue, Nov 16, 2010 at 3:44 PM
Subject: "Future of Javascript" doc from our internal "JavaScript Summit"
last week
To: javascript-standard@google.com
On November 10th and 11th, a number of Google teams representing a variety
of viewpoints on client-side languages met to agree on a common vision for
the future of Javascript.
@dorentus
dorentus / novice_killer.user.js
Created December 3, 2012 04:29 — forked from lyricat/novice_killer.user.js
干掉V2EX上所有使用默认头像用户的发言(去jQuery版)
// ==UserScript==
// @name v2ex novice killer
// @namespace http://shellex.info
// @author shellex(5h3ll3x@gmail.com)
// @description 干掉使用默认头像的人的发言
// @include http://www.v2ex.com/go/*
// @include http://v2ex.com/go/*
// @include http://www.v2ex.com/?tab=*
// @include http://v2ex.com/?tab=*
// @include http://www.v2ex.com/
@dorentus
dorentus / cnblogs_pgfix.user.js
Created December 11, 2012 09:29
Restore #pager_top and get rid of ajax page switching
// ==UserScript==
// @name CnblogsPaginatorFix
// @namespace cnblogs
// @include http://www.cnblogs.com/*
// ==/UserScript==
Array.prototype.slice.call(document.querySelectorAll('#paging_block .pager a')).forEach(function (elm) {
elm.removeAttribute('onClick');
});
@dorentus
dorentus / 95-lolcat
Last active February 15, 2022 12:21
dynamically generated /etc/motd using fortune, cowsay & lolcat,save it as /etc/update-motd.d/95-lolcat.Google `pam_motd` or `update-motd` for more details of dynamically generated message-of-the-day.
#!/bin/bash
# see: http://blog.tomtung.com/2009/11/cowsay-fortune
# http://www.commandlinefu.com/commands/view/3584/remove-color-codes-special-characters-with-sed
# https://github.com/busyloop/lolcat
# https://github.com/dorentus/mruby-lolcat-bin
#
# requires `fortune`, `cowsay`,
# and ruby gem `lolcat` or its mruby version equivalent
export LANG="en_US.UTF-8"
@dorentus
dorentus / waaagh!
Created February 3, 2013 09:53
WAAAAAAAAAAAAAAAAAAAAAAAGH! for bash
type old_command_not_found_handle 2>/dev/null | grep -q 'is a function' > /dev/null
if [ $? -ne 0 ]; then
eval "$(echo "old_command_not_found_handle()"; declare -f command_not_found_handle | tail -n +2)"
fi
command_not_found_handle () {
if [[ ! "$1" ]] ; then
old_command_not_found_handle $@
return $?
fi
Use 'dpkg --get-selections > selections.txt' to save a selection and 'dpkg
--set-selections < selections.txt && apt-get dselect-upgrade' to restore.
@dorentus
dorentus / mruby.rb
Created February 6, 2013 08:10 — forked from kyohsuke/mruby.rb
require 'formula'
class Mruby < Formula
homepage 'http://www.mruby.org/'
head 'https://github.com/mruby/mruby.git'
def install
ENV.j1
system "make"
system "make test"
diff -Naru libpng-1.5.13.org/png.h libpng-1.5.13/png.h
--- libpng-1.5.13.org/png.h 2012-09-30 19:13:07.000000000 +0900
+++ libpng-1.5.13/png.h 2012-09-30 19:13:07.000000000 +0900
@@ -442,6 +442,10 @@
# include "pnglibconf.h"
#endif
+#define PNG_APNG_SUPPORTED
+#define PNG_READ_APNG_SUPPORTED
+#define PNG_WRITE_APNG_SUPPORTED
[color]
ui = auto
[push]
default = simple
[core]
editor = vim
quotepath = false
[alias]
lg = log --graph --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(bold white)— %an%C(reset)%C(bold yellow)%d%C(reset)' --abbrev-commit --date=relative --show-signature
[branch]
id dynamicUITableViewDequeueReusableCellWithIdentifierForIndexPath(id self, SEL cmd, NSString *identifier, NSIndexPath *indexPath)
{
return [self performSelector:@selector(dequeueReusableCellWithIdentifier:) withObject:identifier];
}
void __compat_fix()
{
SEL aSEL = @selector(dequeueReusableCellWithIdentifier:forIndexPath:);
if (![UITableView instancesRespondToSelector:aSEL]) {
BOOL success = class_addMethod([UITableView class], aSEL, (IMP)dynamicUITableViewDequeueReusableCellWithIdentifierForIndexPath, "@@:@");