Android related PC or Mac (or any other computer OS) software. Movie encoders, synchronization, development, etc.
Apr 17th, 2015, 12:14 pm
forum.mobilism.org Code Highlighting JavaScript [Beta] v0.1 by (GL)BigBrother
Requirements: Firefox, Chrome, Maelstrom browser (Opera and Chromium not tested but it should work)
Overview: 118 languages and 54 styles. Automatic language detection. Multi-language code highlighting.
forum.mobilism.org or mobilism.me syntax highlighting in code tag. Thanks to highlightjs.org for highlight.js and css themes.
it'll properly work if there is actually any language written in code tag.

Image

Image

  1. About :
    1. Finally code highlighting for forum.mobilism.org
    2. 118 languages and 54 styles.
    3. Automatic language detection.
    4. Multi-language code highlighting
    5. Support both old and new theme of forum.mobilism.org
    6. Support both forum.mobilism.org and mobilism.me
    7. Support highlighting for Quote tag if you want. just press show highlighting button above Quote.

  2. How to Install Script :
    1. How to Install in Chrome :
      1. Install Tampermonkey Chrome Extension from here. (Search Google if you don't know how)
      2. Install forum.mobilism.org Code Highlighting JavaScript from here
      3. Refresh page and see my comment. If you see highlighting in code tag that's mean it's working fine. otherwise try or contact me.
      4. Enjoy.

    2. How to Install in FireFox:
      1. Install Greasemonkey Firefox add-on from here. (Search Google if you don't know how)
      2. Install forum.mobilism.org Code Highlighting JavaScript from here
      3. Goto Setting > Add-ons > User Scripts > Enable forum.mobilism.org Code Highlighting JavaScript.
      4. Refresh page and see my comment. If you see highlighting in code tag that's mean it's working fine. otherwise try or contact me.
      5. Enjoy.

  3. How to change Theme:
    1. First install script. (read above)
    2. Refresh page and see my comment. If you see highlighting in code tag that's mean it's working fine. otherwise try or contact me.
    3. Now to Change theme, goto top of the page and just beneath the topic name their is a select menu for theme. just Select any theme and press go.
    4. It'll refresh page automatically. Now it'll change the theme.

  4. How to Update Script :
    1. Goto forum.mobilism.org Code Highlighting JavaScript page.
    2. Click on Install button.
    3. It will offer you to Install script or Update script.
    4. Once Script is install, refresh page and see my comment. If you see highlighting in code tag that's mean it's working fine. otherwise try or contact me.
    5. Enjoy.

This app has NO advertisements

More Info:
Code: Select allhttp://forum.mobilism.org/viewtopic.php?t=1090454

Download Instructions: written by (GL)BigBrother
(for installation and update read description)
Tampermonkey Chrome Extension
Greasemonkey Firefox add-on
forum.mobilism.org Code Highlighting JavaScript
Apr 17th, 2015, 12:14 pm
Last edited by (GL)BigBrother on Apr 17th, 2015, 12:15 pm, edited 2 times in total.
Apr 17th, 2015, 12:14 pm
If you don't see code highlighting than you should install script first. (Read above how to install Script)
Here is the demo of few programing languages. For more demo go https://highlightjs.org/static/demo/

C
Code: Select all#include <stdio.h>
 
int main()
{
  int year;
 
  printf("Enter a year to check if it is a leap year\n");
  scanf("%d", &year);
 
  if ( year%400 == 0)
    printf("%d is a leap year.\n", year);
  else if ( year%100 == 0)
    printf("%d is not a leap year.\n", year);
  else if ( year%4 == 0 )
    printf("%d is a leap year.\n", year);
  else
    printf("%d is not a leap year.\n", year); 
 
  return 0;
}


C++
Code: Select all#include <iostream>
#define IABS(x) ((x) < 0 ? -(x) : (x))

int main(int argc, char *argv[]) {

  /* An annoying "Hello World" example */
  for (auto i = 0; i < 0xFFFF; i++)
    cout << "Hello, World!" << endl;

  char c = '\n';
  unordered_map <string, vector<string> > m;
  m["key"] = "\\\\"; // this is an error

  return -2e3 + 12l;
}


C#
Code: Select allusing System;

#pragma warning disable 414, 3021

public class Program
{
    /// <summary>The entry point to the program.</summary>
    public static int Main(string[] args)
    {
        Console.WriteLine("Hello, World!");
        string s = @"This
""string""
spans
multiple
lines!";

        dynamic x = new ExpandoObject();
        x.MyProperty = 2;

        return 0;
    }
}

async Task<int> AccessTheWebAsync()
{
    // ...
    string urlContents = await getStringTask;
    return urlContents.Length;
}

internal static void ExceptionFilters()
{
  try
  {
      throw new Exception();
  }
  catch (Exception e) when (e.Message == "My error") { }
}


CSS
Code: Select all@media screen and (-webkit-min-device-pixel-ratio: 0) {
  body:first-of-type pre::after {
    content: 'highlight: ' attr(class);
  }
  body {
    background: linear-gradient(45deg, blue, red);
  }
}

@import url('print.css');
@page:right {
 margin: 1cm 2cm 1.3cm 4cm;
}

@font-face {
  font-family: Chunkfive; src: url('Chunkfive.otf');
}

div.text,
#content,
li[lang=ru] {
  font: Tahoma, Chunkfive, sans-serif;
  background: url('hatch.png') /* wtf? */;  color: #F0F0F0 !important;
  width: 100%;
}


Smali
Code: Select all.class public Lcom/test/Preferences;
.super Landroid/preference/PreferenceActivity;
.source "Preferences.java"


# instance fields
.field private PACKAGE_NAME:Ljava/lang/String;


# direct methods
.method public constructor <init>()V
    .registers 1
    .annotation build Landroid/annotation/SuppressLint;
        value = {
            "InlinedApi"
        }
    .end annotation

    .prologue
    .line 25
    invoke-direct {p0}, Landroid/preference/PreferenceActivity;-><init>()V

    const-string v4, "ASDF!"

    .line 156
    .end local v0           #customOther:Landroid/preference/Preference;
    .end local v1           #customRate:Landroid/preference/Preference;
    .end local v2           #hideApp:Landroid/preference/Preference;
    :cond_56

        .line 135
    invoke-static {p1}, Lcom/google/ads/AdActivity;->b(Lcom/google/ads/internal/d;)Lcom/google/ads/internal/d;

    .line 140
    :cond_e
    monitor-exit v1
    :try_end_f
    .catchall {:try_start_5 .. :try_end_f} :catchall_30

    .line 143
    invoke-virtual {p1}, Lcom/google/ads/internal/d;->g()Lcom/google/ads/m;

    move-result-object v0

    iget-object v0, v0, Lcom/google/ads/m;->c:Lcom/google/ads/util/i$d;

    invoke-virtual {v0}, Lcom/google/ads/util/i$d;->a()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/app/Activity;

    .line 144
    if-nez v0, :cond_33

    .line 145
    const-string v0, "activity was null while launching an AdActivity."

    invoke-static {v0}, Lcom/google/ads/util/b;->e(Ljava/lang/String;)V

    .line 160
    :goto_22
    return-void

    .line 136
    :cond_23
    :try_start_23
    invoke-static {}, Lcom/google/ads/AdActivity;->c()Lcom/google/ads/internal/d;

    move-result-object v0

    if-eq v0, p1, :cond_e

    return-void
.end method


HTML
Code: Select all<!DOCTYPE html>
<html>
<body>

<p id="demo">Click the button to change the text in this paragraph.</p>

<button onclick="myFunction()">Try it</button>

<script>
function myFunction() {
    document.getElementById("demo").innerHTML = "Hello World";
}
</script>

</body>
</html>


JAVA
Code: Select all/**
 * @author John Smith <john.smith@example.com>
 * @version 1.0
*/
package l2f.gameserver.model;

import java.util.ArrayList;

public abstract class L2Character extends L2Object {
  public static final Short ABNORMAL_EFFECT_BLEEDING = 0x0_0_0_1; // not sure

  public void moveTo(int x, int y, int z) {
    _ai = null;
    _log.warning("Should not be called");
    if (1 > 5) {
      return;
    }
  }

  /** Task of AI notification */
  @SuppressWarnings( { "nls", "unqualified-field-access", "boxing" })
  public class NotifyAITask implements Runnable {
    private final CtrlEvent _evt;

    List<String> mList = new ArrayList<String>()

    public void run() {
      try {
        getAI().notifyEvent(_evt, _evt.class, null);
      } catch (Throwable t) {
        t.printStackTrace();
      }
    }
  }
}


JavaScript
Code: Select allimport {x, y} as p from 'point';
const ANSWER = 42;

class Car extends Vehicle {
  constructor(speed, cost) {
    super(speed);

    var c = Symbol('cost');
    this[c] = cost;

    this.intro = `This is a car runs at
      ${speed}.`;
  }
}

for (let num of [1, 2, 3]) {
  console.log(num + 0b111110111);
}

function $initHighlight(block, flags) {
  try {
    if (block.className.search(/\bno\-highlight\b/) != -1)
      return processBlock(block.function, true, 0x0F) + ' class=""';
  } catch (e) {
    /* handle exception */
    var e4x =
        <div>Example
            <p>1234</p></div>;
  }
  for (var i = 0 / 2; i < classes.length; i++) { // "0 / 2" should not be parsed as regexp
    if (checkCondition(classes[i]) === undefined)
      return /\d+[\s/]/g;
  }
  console.log(Array.every(classes, Boolean));
}

export  $initHighlight;


JSON
Code: Select all[
  {
    "title": "apples",
    "count": [12000, 20000],
    "description": {"text": "...", "sensitive": false}
  },
  {
    "title": "oranges",
    "count": [17500, null],
    "description": {"text": "...", "sensitive": false}
  }
]


Objective C
Code: Select all#import <UIKit/UIKit.h>
#import "Dependency.h"

@protocol WorldDataSource
@optional
- (NSString*)worldName;
@required
- (BOOL)allowsToLive;
@end

@interface Test : NSObject <HelloDelegate, WorldDataSource> {
  NSString *_greeting;
}

@property (nonatomic, readonly) NSString *greeting;
- (IBAction) show;
@end

@implementation Test

@synthesize test=_test;

+ (id) test {
  return [self testWithGreeting:@"Hello, world!\nFoo bar!"];
}

+ (id) testWithGreeting:(NSString*)greeting {
  return [[[self alloc] initWithGreeting:greeting] autorelease];
}

- (id) initWithGreeting:(NSString*)greeting {
  if ( (self = [super init]) ) {
    _greeting = [greeting retain];
  }
  return self;
}

- (void) dealloc {
  [_greeting release];
  [super dealloc];
}

@end


PHP
Code: Select allrequire_once 'Zend/Uri/Http.php';

namespace Location\Web;

interface Factory
{
    static function _factory();
}

abstract class URI extends BaseURI implements Factory
{
    abstract function test();

    public static $st1 = 1;
    const ME = "Yo";
    var $list = NULL;
    private $var;

    /**
     * Returns a URI
     *
     * @return URI
     */
    static public function _factory($stats = array(), $uri = 'http')
    {
        echo __METHOD__;
        $uri = explode(':', $uri, 0b10);
        $schemeSpecific = isset($uri[1]) ? $uri[1] : '';
        $desc = 'Multi
line description';

        // Security check
        if (!ctype_alnum($scheme)) {
            throw new Zend_Uri_Exception('Illegal scheme');
        }

        $this->var = 0 - self::$st;
        $this->list = list(Array("1"=> 2, 2=>self::ME, 3 => \Location\Web\URI::class));

        return [
            'uri'   => $uri,
            'value' => null,
        ];
    }
}

echo URI::ME . URI::$st1;

__halt_compiler () ; datahere
datahere
datahere */
datahere


Python
Code: Select all@requires_authorization
def somefunc(param1='', param2=0):
    r'''A docstring'''
    if param1 > param2: # interesting
        print 'Gre\'ater'
    return (param2 - param1 + 1 + 0b10l) or None

class SomeClass:
    pass

>>> message = '''interpreter
... prompt'''


SQL
Code: Select allBEGIN;
CREATE TABLE "topic" (
    -- This is the greatest table of all time
    "id" serial NOT NULL PRIMARY KEY,
    "forum_id" integer NOT NULL,
    "subject" varchar(255) NOT NULL -- Because nobody likes an empty subject
);
ALTER TABLE "topic" ADD CONSTRAINT forum_id FOREIGN KEY ("forum_id") REFERENCES "forum" ("id");

-- Initials
insert into "topic" ("forum_id", "subject") values (2, 'D''artagnian');

select /* comment */ count(*) from cicero_forum;

-- this line lacks ; at the end to allow people to be sloppy and omit it in one-liners
/*
but who cares?
*/
COMMIT


Swift
extension MyClass : Interface {
class func unarchiveFromFile<A>(file : A, (Int,Int) -> B) -> SKNode? {
let path: String = bundle.pathForResource(file, ofType: "file\(name + 5).txt")
let funnyNumber = 3 + 0xC2.15p2 * (1_000_000.000_000_1 - 000123.456) + 0o21
var sceneData = NSData.dataWithContentsOfFile(path, options: .DataReadingMappedIfSafe, error: nil)
/* a comment /* with a nested comment */ and the end */
}
@objc override func shouldAutorotate() {
return true
}
}


XML
<?xml version="1.0" encoding="UTF-8"?>
<note>
<to> Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>


HTML
<!DOCTYPE html>
<html>
<body>

<p id="demo">Click the button to change the text in this paragraph.</p>

<div id="parentDiv">
<div id="childDiv">
<div id="subChildDiv">
</div>
</div>
</div>

//All type of divs

<button onclick="myFunction()">Try it</button>

<br>
<br>
<br>
<br>
<br>
<br>
<br>

<script>
function myFunction() {
document.getElementById("demo").innerHTML = "Hello World";
}
</script>

</body>
</html>
Apr 17th, 2015, 12:14 pm
Last edited by (GL)BigBrother on May 9th, 2015, 8:57 pm, edited 12 times in total.
Apr 17th, 2015, 8:48 pm
Absolutely amazing work!
Apr 17th, 2015, 8:48 pm
Apr 17th, 2015, 9:04 pm
Yes a hard work here...work great for me.
thanks BB!!
Apr 17th, 2015, 9:04 pm

Do not forget to give thanks and support the developers! If you like the app, buy it!
PM me to fix links.
Image
May 3rd, 2015, 7:32 am
Wow, this is great. Thank y ou so much for this.
May 3rd, 2015, 7:32 am