Skip to content

Instantly share code, notes, and snippets.

@STRd6
STRd6 / haml.jison
Created June 27, 2013 04:05
Formalizing Haml
/* lexical grammar */
%lex
%%
\n return 'NEWLINE';
<<EOF>> return 'EOF';
" " return 'INDENT';
"-" return 'HYPHEN';
"(" return 'LEFT_PARENTHESIS';
+
-
*
/
%
^
|
&
**
<
@STRd6
STRd6 / bjorx.rb
Created June 22, 2013 02:20
Save data to your local filesystem by posting to your webserver.
require "sinatra"
configure do
set :root, "."
set :public_folder, "."
end
# Any post to /save will write data to the path provided.
post '/save' do
data = params["data"]
<script>alert("yolo!")</script>
@STRd6
STRd6 / CoffeeTown.md
Created May 8, 2013 20:38
Some notes about CoffeeScript

The Basics

Variables

greeting = "hello"
location = "world"

x = 8

y = 3

// Created by STRd6
// MIT License
// jquery.paste_image_reader.js
(function($) {
var defaults;
$.event.fix = (function(originalFix) {
return function(event) {
event = originalFix.apply(this, arguments);
if (event.type.indexOf('copy') === 0 || event.type.indexOf('paste') === 0) {
event.clipboardData = event.originalEvent.clipboardData;
findCondenseOrCreate = (normalizedTag, name, fn) ->
query = new Parse.Query("Category")
query.equalTo "normalizedTag", normalizedTag
query.find
success: (results) ->
[category, duplicates...] = results
# We could try and collect numbers, but we really
# don't care since we should be recounting anyway
@STRd6
STRd6 / gist:2647338
Created May 9, 2012 17:56 — forked from bluefuton/gist:1468061
OS X: replace tabs with spaces in all files using expand
find . -name "*.[hm]" | while read line; do expand -t 2 "$line" > "$line.new"; mv "$line.new" "$line"; sed -i "" 's/ *$//' "$line"; done
#include "Extractor.h"
#include "XModule.h"
#include <iostream>
using namespace std;
int main ()
{
XModule* module = new XModule();
SYSCHAR* fileName = "Greensleeves.xm";
@STRd6
STRd6 / gist:2288230
Created April 3, 2012 00:23
Mysterious array allocation
(gdb) break XModule.cpp:1882
Breakpoint 1 at 0x407d84: file XModule.cpp, line 1882. (2 locations)
(gdb) run
Starting program: /home/daniel/Desktop/milkytracker-0.90.85/src/milkyplay/extractor
Breakpoint 1, XModule (this=0x76c670) at XModule.cpp:1882
1882 phead = new TXMPattern[256];
(gdb) print phead
$1 = (TXMPattern *) 0x0
(gdb) print header