Skip to content

Instantly share code, notes, and snippets.

@onozaty
onozaty / gist:6206064
Created August 11, 2013 17:36
cover up exception
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Activation;
using System.Runtime.Remoting.Messaging;
using System.Runtime.Remoting.Proxies;
using System.Runtime.Remoting.Services;
namespace CoverUpException
{
public class CoverUpExceptionProxy : RealProxy
[CoverUpException]
public class Target : ContextBoundObject
{
@onozaty
onozaty / gist:6342227
Last active December 21, 2015 17:39
var clipboard = require("sdk/clipboard");
// 設定
clipboard.set("xxxx");
// 取得
var contents = clipboard.get();
@onozaty
onozaty / gist:6342405
Last active December 21, 2015 17:39
copy to clipboard on xul base addon.
const gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
.getService(Components.interfaces.nsIClipboardHelper);
// 設定
gClipboardHelper.copyString("xxxx");
@onozaty
onozaty / gist:6342427
Created August 26, 2013 15:06
paste clipboard on xul base addon.
var clipboard = Cc["@mozilla.org/widget/clipboard;1"].createInstance(Ci.nsIClipboard);
var trans = Cc["@mozilla.org/widget/transferable;1"].createInstance(Ci.nsITransferable);
trans.addDataFlavor("text/unicode");
clipboard.getData(trans, clipboard.kGlobalClipboard);
var str = {};
var strLength = {};
int[] empty = new int[0];
Console.WriteLine(
empty.Any(x => x % 2 == 0)); // => False
Console.WriteLine(
empty.All(x => x % 2 == 0)); // => True
@onozaty
onozaty / gist:8501987
Created January 19, 2014 08:31
System/Linq/Enumerable.cs
public static bool Any<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate) {
if (source == null) throw Error.ArgumentNull("source");
if (predicate == null) throw Error.ArgumentNull("predicate");
foreach (TSource element in source) {
if (predicate(element)) return true;
}
return false;
}
public static bool All<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate) {
@onozaty
onozaty / gist:69acc57b1ad38180ab23
Created July 5, 2014 07:07
Change header color setting code by Redmine view customize plugin
#top-menu {
background-color: #006400; /* dark green */
}
#header {
background-color: #008000; /* green */
}
@onozaty
onozaty / gist:71aba23ec1b80e1b7124
Created July 7, 2014 16:17
Highlight login user name code by Redmine view customize plugin
$(function(){
var userUrl = $("div#loggedas a").attr("href");
$("a[href='" + userUrl + "']").css({
"font-size": "150%",
});
});
@onozaty
onozaty / gist:46e91c13c491925ca06f
Last active August 29, 2015 14:04
Add header menu by Redmine view customize plugin
$(function() {
$('#top-menu>ul')
.append('<li><a href="/projects/project1">Project1</a></li>');
})();