Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Objective-BB

Name: Anonymous 2012-09-03 19:01

[[[[[b] i] o] u] @"ENTERPRISE"]

Name: Anonymous 2012-09-03 19:53

[[[[[NSBBcodeFormatter alloc] init] autorelease] formatString:@"ENTERPRISE" withBBCodeTags:[[NSArray alloc] initWithElements: [NSBBCodeFormatter bbcodeTagB], [NSBBCodeFormatter bbcodeTagU], [NSBBCodeFormatter bbcodeTagO], [NSBBCodeFormatter bbcodeTagI], NULL]];

Name: Anonymous 2012-09-03 19:56

(text-bold
    (text-italicize
        (text-underline
            (text-vinculum
                "ACADEMIC QUALITY"))))

Name: Anonymous 2012-09-03 20:04

foldr bbcode [B,U,O,I] $ "hipster quality" where bbcode t = (("["++t++"]")++) . (++("[/"++t++"]"))

Name: Anonymous 2012-09-03 20:14

Objective C should have been called D:

Name: Anonymous 2012-09-03 20:51

#import <Foundation/Foundation.h>

@interface BBString : NSObject {
    NSString *str;
}
@property (retain) NSString *str;
-(BBString *)initWithString:(NSString *)s;
-(BBString *)formatWithTag:(NSString *)tag;
-(BBString *)b;
-(BBString *)i;
-(BBString *)o;
-(BBString *)u;
@end

@implementation BBString
@synthesize str;
-(BBString *)initWithString:(NSString *)s {
    self = [super init];
    self.str = s;
    return self;
}
-(BBString *)formatWithTag:(NSString *)tag {
    self.str = [NSString stringWithFormat:@"[%@]%@[/%@]", tag, self.str, tag];
    return self;
}
-(BBString *)b {
    return [self formatWithTag:@"b"];
}
-(BBString *)i {
    return [self formatWithTag:@"i"];
}
-(BBString *)o {
    return [self formatWithTag:@"o"];
}
-(BBString *)u {
    return [self formatWithTag:@"u"];
}
@end

int main() {
    NSAutoreleasePool *pool = [NSAutoreleasePool new];
    printf("%s\n", [[[[[[[[[BBString alloc] autorelease] initWithString:@"ENTERPRISE"] b] i] o] u] str] UTF8String]);
    [pool release];
    return 0;
}

Name: Anonymous 2012-09-03 21:14

public class BBCodeFormattedStringFactoryFactory

Name: Anonymous 2012-09-03 23:01

>>3

(b (i (u (o HAX MY ANUS))))

Name: Anonymous 2012-09-03 23:57


var output = []
for (var i = 0; i < 3; i++) {
  var words = ["HAX", "MY", "ANUS"];
  (function (i) {
    (function (boldstyle) {
      (function (italicstyle) {
        (function (underlinestyle) {
          (function (overlinestyle) {
             (function (message) {
                output[i] = boldstyle(italicstyle(underlinestyle(overlinestyle(message))));
             })(words[i]);
          })(new _$.OverlineStyle(this));
        })(new _$.UnderlineStyle(this));
      })(new _$.ItalicStyle(this));
    })(new _$.BoldStyle(this));
  })(i);
}
if (isNaN(1 / function () { }))
  document.write(output[0] + " " + output[1] + " " + output[2])

Name: sage 2012-09-04 6:23

using System;
 
// EXPERT ENTERPRISE QUALITY ROBUST AND SCALABLE C# BBCODE TAG GENERATOR
namespace EnterpriseBBCode
{
    [Flags]
    public enum TextFormat
    {
        Normal     = 0x0,
        Bold       = 0x1,
        Italic     = 0x2,
        Underlined = 0x4,
        Overlined  = 0x8,
    }
 
    public class Text
    {
        private string str;
        public TextFormat format { get; set; }
 
        public Text(string text)
        {
            str = text;
            format = TextFormat.Normal;
        }
 
        private void AddTag(string tag)
        {
            str = str.Insert(0, tag);
            str = str.Insert(str.Length, tag.Insert(1, "/"));
        }
 
        public string Render()
        {
            if ((format & TextFormat.Bold) == TextFormat.Bold)
            {
                AddTag("[b]");
            }
            if ((format & TextFormat.Italic) == TextFormat.Italic)
            {
                AddTag("[i]");
            }
            if ((format & TextFormat.Underlined) == TextFormat.Underlined)
            {
                AddTag("[u]");
            }
            if ((format & TextFormat.Overlined) == TextFormat.Overlined)
            {
                AddTag("[o]");
            }
            return str;
        }
    }
 
    public interface ITextFormattable
    {
        void ApplyFormat(Text text);
    }
 
    public class B : ITextFormattable
    {
        public void ApplyFormat(Text text)
        {
            text.format |= TextFormat.Bold;
        }
    }
 
    public class I : ITextFormattable
    {
        public void ApplyFormat(Text text)
        {
            text.format |= TextFormat.Italic;
        }
    }
 
    public class U : ITextFormattable
    {
        public void ApplyFormat(Text text)
        {
            text.format |= TextFormat.Underlined;
        }
    }
 
    public class O : ITextFormattable
    {
        public void ApplyFormat(Text text)
        {
            text.format |= TextFormat.Overlined;
        }
    }
 
    public class TextFormatterFactory
    {
        public ITextFormattable CreateTextFormatterFromString(string tag)
        {
            switch (tag)
            {
                case "b":
                    return new B();
 
                case "i":
                    return new I();
 
                case "u":
                    return new U();
 
                case "o":
                    return new O();
 
                default:
                    throw new ArgumentException("tag");
            }
        }
    }
 
    public static class Program
    {
        public static void Main(string[] args)
        {
            Text text = new Text("ENTERPRISE");
            TextFormatterFactory tff = new TextFormatterFactory();
 
            B boldFormatter = (B)tff.CreateTextFormatterFromString("b");
            boldFormatter.ApplyFormat(text);
 
            I italicFormatter = (I)tff.CreateTextFormatterFromString("i");
            italicFormatter.ApplyFormat(text);
 
            U underlineFormatter = (U)tff.CreateTextFormatterFromString("u");
            underlineFormatter.ApplyFormat(text);
 
            O overlineFormatter = (O)tff.CreateTextFormatterFromString("o");;
            overlineFormatter.ApplyFormat(text);
 
            Console.Write(text.Render());
        }
    }
}

Name: Anonymous 2012-09-04 6:39

>>9
Javascript is amazing. You should have also added some node.js in it to ensure proper parallelization in the cloud.

Name: Anonymous 2012-09-04 21:35

FFOC:

local mt
mt = {
    __call = function (self, text)
        return self.starttags .. text .. self.endtags
    end,
    __index = function (self, key)
        return setmetatable({ starttags = ("%s[%s]"):format(self.starttags, key), endtags = ("[/%s]%s"):format(key, self.endtags) }, mt)
    end
}

local bbcode = setmetatable({ starttags = "", endtags = "" }, mt)

print("For the love of " .. bbcode.spoiler "/prog/" .. ", " .. bbcode.b.i.o.u "HAX MY ANUS" .. ", ``please''" .. bbcode.i "!")

Name: Anonymous 2012-09-04 21:45

>>9
Simply disgusting.

Name: Anonymous 2012-09-04 21:52

fun bbcode tag str = "["^tag^"]"^str^"[/"^tag^"]"
val bold = bbcode "b"
val italic = bbcode "i"
val overline = bbcode "o"
val underline = bbcode "u"
val () = (print o bold o italic o overline o underline) "ENTERPRISE QUALITY"

Name: Anonymous 2012-09-04 22:07

The Achilles Heel of JavaScript is its inconsistent behavior across implementations. It is virtually impossible to use it to do anything robust on the client side.

JavaScript is weakly typed, and the automatic coercions that it does can produce surprising results. "2" + "3" is "23" (+, when applied to two strings, performs concatenation); "2" * "3" is 6. (Multiplication not defined for strings; so the language tries converting them to numerals, succeeds, and multiplies those). This can be surprising.

Rather annoying gotcha in array constructor. new Array() produces empty array; new Array(2,3) produces array with 2 and 3 as its elements. new Array(5) does not produce array with 5 as its single element; instead, it returns a 5-element array!

Whereas most languages have one universal singular value (null/nil/Void/whatever); JavaScript has three - "false", "null" and "undefined". That leads to confusing and irregular semantics.

No integral types - the only numeric type supported is an IEEE754 double-precision float. For a scripting language, this limitation is probably less obnoxious than it would be elsewhere.

Language has LexicalScoping, but with an interesting twist. Unlike JavaScripts brethen C/C++/Java/C#/etc, where variables introduced in an anonymous block within a function are only valid within that block; in JavaScript such variables are valid for the entire function.

Every script is executed in a single global namespace that is accessible in browsers with the window object.

Automatic type conversion between strings and numbers, combined with '+' overloaded to mean concatenation and addition. This creates very counterintuitive effects if you accidentally convert a number to a string:

 var i = 1; 
 // some code
 i = i + ""; // oops!
 // some more code
 i + 1;  // evaluates to the String '11'
 i - 1;  // evaluates to the Number 0

The automatic type conversion of the + function also leads to the intuitive effect that += 1 is different then the ++ operator:

 var j = "1";
 j++; // j becomes 2
 
 var k = "1";
 k += 1; // k becomes "11"




'' == '0' //false
0 == '' //true
0 == '0' //true
false == 'false' //false
false == '0' //true
false == undefined //false
false == null //false
null == undefined //true
typeof NaN //number
NaN == NaN //false

var a = [123];
var b = 123;
a == b; //true
a[0] == b[0]; //false

var a = [0];
a == a;  //true
a == !a; //true

" \t\r\n" == 0 // true
Math.min() < Math.max(); // false
",,," == Array((null,'cool',false,NaN,4)); // true

new Array([],null,undefined,null) == ",,,"; // true

var foo = [0];
foo == foo  // true
foo == !foo // true

function toInt(number) {return number && + number | 0 || 0;}
toInt("1");  // 1
toInt("1.2");  // 1
toInt("-1.2");  // -1
toInt(1.2);  // 1
toInt(0);  // 0
toInt("0");  // 0
toInt(Number.NaN);  // 0
toInt(1/0);  // 0


[] + [] //
[] + {} // [object Object]
{} + [] // 0
{} + {} // NaN
"S" - 1 // NaN




$ js --version
JavaScript-C 1.7.0 2007-10-03
usage: js [-PswWxCi] [-b branchlimit] [-c stackchunksize] [-v version] [-f scriptfile] [-e script] [-S maxstacksize] [scriptfile] [scriptarg...]
$ js
js> 0 == ''
true
js> false == 'false'
false
js> false == '0'
true
js> false == undefined
false
js> " \t\r\n" == 0
true
js> Math.min() < Math.max()
false
js> ",,," == Array((null,'cool',false,NaN,4))
true
js> var foo = [0]
js> foo == foo
true
js> foo == !foo
true
js> function toInt(number) {return number && + number | 0 || 0;}
js> toInt("1")
1
js> toInt("1.2")
1
js> toInt("-1.2")
-1
js> toInt(1/0)
0
js>

Name: Anonymous 2012-09-04 22:47

>>15
The core behaviour of JavaScript is quite consistent across implementations, as it's specified in great detail by the ECMA-262 standard. The host objects (for example, the DOM in browsers) do have differences, but these are less problematic than they used to be. You can generally follow W3 specs relating to HTML and DOM in any modern browser and get consistent results.

Name: Anonymous 2012-09-04 22:53

No integral types - the only numeric type supported is an IEEE754 double-precision float. For a scripting language, this limitation is probably less obnoxious than it would be elsewhere.
http://www.khronos.org/registry/typedarray/specs/latest/

Name: Anonymous 2012-09-04 22:59

>>17
so now it has the overhead of double->whatever and whatever->double casts all the time

Name: Anonymous 2012-09-04 23:37

>>18
It works well enough for http://bellard.org/jslinux/.

Name: Anonymous 2012-09-04 23:54

>>19
wow, a cli-only linux, where gcc takes several minutes to compile a hello world

i'm truly blown away

Name: Anonymous 2012-09-04 23:56

>>20
gcc is slow-ass shit anyway. Use tcc instead.

Name: Anonymous 2012-09-04 23:56

>>20
back to whence you came, interloper.

Name: Anonymous 2012-09-05 0:03

slow-ass shit
slow ass-shit
ass-shit

Name: Anonymous 2012-09-05 0:20

>>23
Back to reddit and xkcd and gaia and /b/.

Name: Anonymous 2012-09-05 10:44

>>21
I want C11.

Name: Anonymous 2012-09-05 16:24

>>15
Terrible!

Name: Anonymous 2012-09-05 16:32

>>7
public class BBCodeFormattedStringFactoryFactory extends HTMLFormattedStringFactoryFactory

Don't change these.
Name: Email:
Entire Thread Thread List