Skip to content

Instantly share code, notes, and snippets.

@clupasq
clupasq / AssemblyInfo.cs
Created March 13, 2012 08:49
log4net colored console+flat file appender configuration
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
@clupasq
clupasq / golfscript_snippets
Last active October 5, 2015 07:58
Golfscript snippets
.,{)\.@%!},,2= # is number prime (expects number on stack and adds 1 or 0 (leaves number on stack))
:§,{)§\%!},,2= # just like above, except this consumes the number from the stack.
..,1>{*}*\%)= # shorter version, using Wilson's theorem (https://en.wikipedia.org/wiki/Wilson%27s_theorem)
# must take a parameter > 1, therwise fails
@clupasq
clupasq / gist:2994524
Created June 26, 2012 08:53
Git config
git config --global user.name <user>
git config --global user.email <email>
git config --global help.autocorrect 1
git config --global color.ui auto
git config --global core.autocrlf true
git config --global alias.glog "log --graph --oneline --all --decorate"
git config --global core.editor "C:/Windows/notepad.exe"
@clupasq
clupasq / .hgignore
Created June 30, 2013 19:06
basic .hgignore file
# use glob syntax
syntax: glob
*.obj
*.pdb
*.user
*.aps
*.pch
*.vspscc
*.vssscc
@clupasq
clupasq / golfscript.sublime-build
Last active December 19, 2015 21:09
Golfscript Build System for Sublime 3
{
"cmd": ["ruby", "D:\\path\\to\\golfscript.rb", "$file"],
"selector": "source.gs"
}
@clupasq
clupasq / RunnableInDebugOnlyAttribute.cs
Created August 8, 2013 05:45
xUnit.net RunnableInDebugOnlyAttribute
public class RunnableInDebugOnlyAttribute : FactAttribute
{
private string _skip;
public override string Skip
{
get
{
return Debugger.IsAttached
? _skip
@clupasq
clupasq / subByColor.js
Created September 10, 2013 06:52
SumByColor v1.1 - Added methods for Foreground Color - replaced the deprecated getBackgroundColor() with getBackground()
function getBackgroundColor(rangeSpecification) {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
return sheet.getRange(rangeSpecification).getBackground();
}
function getForegroundColor(rangeSpecification) {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
return sheet.getRange(rangeSpecification).getFontColor();
}
(function(){
var styleId = 'invert-style';
var style = document.getElementById(styleId);
if (style) {
style.parentElement.removeChild(style);
} else {
style = document.createElement('style');
style.id = styleId;
style.textContent = '' +
'html,img, video, object, [style*=url] {' +
// Run this script on any page to load the DataTables library
// (https://datatables.net/)
// and add DataTable functionality to all tables
var addJqueryIfNotPresent = function(callback){
if(!window.jQuery){
var scr = document.createElement('script');
scr.src = 'https://code.jquery.com/jquery-2.2.4.min.js';
scr.onload = function(){ callback && callback(); };
document.head.appendChild(scr);
@clupasq
clupasq / supercrazy.lua
Created May 19, 2017 13:07
Super crazy Blobby Volley rules - before each serve, the game switches to a random mode between Jumping Jack, Sticky or Default
__AUTHOR__ = "wolf & radu"
__TITLE__ = "Super Crazy"
-- Based on two other game modes by chameleon: Jumping Jack and Sticky Mode
mode = "default"
function randomize()
x = math.random(1,3)
if x == 1 then mode = "default"
elseif x == 2 then mode = "jumping"