Skip to content

Instantly share code, notes, and snippets.

@Whiteknight
Whiteknight / output.txt
Created February 5, 2012 17:14
Optional Args in Winxed
<winxed git:optional_args> ./winxed test.winxed
foo
4
5
6
bar
foo
7
@Whiteknight
Whiteknight / winxedcc.winxed
Created February 18, 2012 18:26
pure winxed-to-pbc compiler
function get_winxed_compiler(string pbc_name = "winxedst3.pbc")
{
var wx_pbc = load_packfile(pbc_name);
for (var load_sub in wx_pbc.subs_by_tag("load"))
load_sub();
return compreg("winxed");
}
function main[main](var args)
{
@Whiteknight
Whiteknight / generated.pir
Created March 22, 2012 15:44
Errors with winxed optional params
.sub 'whatever' :subid('WSubId_2')
.param string __ARG_1 :optional
.param int __opt_flag__ARG_1 :opt_flag
if __opt_flag__ARG_1 goto __label_1
.annotate 'line', 10
$P1 = WSubId_1()
set __ARG_1, $P1
__label_1:
.const 'Sub' WSubId_1 = "WSubId_1"
.annotate 'line', 12
@Whiteknight
Whiteknight / orgapp.txt
Created March 23, 2012 18:53
Parrot organization GSOC application (raw)
Organization ID parrot
Organization Name Parrot Foundation
Organization Description The Parrot Foundation supports development of the Parrot Virtual Machine (PVM) and an entire ecosystem of related library and compiler projects.
Organization Home Page URL http://parrot.org/
Main Organization License Artistic license 2.0
@Whiteknight
Whiteknight / CurrentSettings.vssettings
Created November 30, 2012 20:58
My most recent vssettings file from work
<UserSettings><ApplicationIdentity version="10.0"/><ToolsOptions><ToolsOptionsCategory name="Environment" RegisteredName="Environment"><ToolsOptionsSubCategory name="Documents" RegisteredName="Documents" PackageName="Visual Studio Environment Package"><PropertyValue name="ShowMiscFilesProject">false</PropertyValue><PropertyValue name="AutoloadExternalChanges">false</PropertyValue><PropertyValue name="CheckForConsistentLineEndings">false</PropertyValue><PropertyValue name="SaveDocsAsUnicodeWhenDataLoss">false</PropertyValue><PropertyValue name="InitializeOpenFileFromCurrentDocument">true</PropertyValue><PropertyValue name="ReuseSavedActiveDocWindow">false</PropertyValue><PropertyValue name="DetectFileChangesOutsideIDE">true</PropertyValue><PropertyValue name="DontShowGlobalUndoChangeLossDialog">true</PropertyValue><PropertyValue name="AllowEditingReadOnlyFiles">true</PropertyValue><PropertyValue name="DocumentDockPreference">1</PropertyValue><PropertyValue name="MiscFilesProjectSavesLastNItems">0</PropertyValu
@Whiteknight
Whiteknight / blog.rb
Created December 12, 2012 23:07
If I run this code as-is, the function returns the list of posts as expected. If I uncomment line #4, the function returns an array of nil, breaking my view.
def posts_in_order
ordered = posts.sort{|x, y| x.number <=> y.number }
dummy = for i in (0..ordered.length) do
#x = ordered[i].number
end
return ordered
end
@Whiteknight
Whiteknight / map.cs
Created May 8, 2015 17:56
Map DataRow to nested object
private CreateItem<T>(DataRow row)
where T : new()
{
T item = new T();
foreach (PropertyInfo property in typeof(T).GetProperties())
{
MapFromDataRow(row, "", property, item);
}
return item;