This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hello { | |
public static boolean ensureEncodingToUTF8() { | |
String osEncoding = System.getProperty("file.encoding"); | |
if (!osEncoding.equals("UTF-8") || !osEncoding.equals("UTF8")) { | |
java.lang.System.setProperty("file.encoding", "UTF-8"); | |
try { | |
System.setOut(new java.io.PrintStream(System.out, true, "UTF-8")); | |
} catch (Exception inner) { | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- module fmt_bug. | |
:- interface. | |
:- import_module io. | |
:- pred main(io::di, io::uo) is det. | |
:- implementation. | |
:- import_module float. | |
:- import_module list. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static class FirstCharUtf32 { | |
public static bool FirstChar(string Str, out int First) { | |
bool SUCCESS_INDICATOR; | |
int len = Str.Length; | |
if (len > 0) { | |
First = Str[0]; | |
if (char.IsSurrogate((char)First)) { | |
if (SUCCESS_INDICATOR = char.IsSurrogatePair(Str, 0)) { | |
First = char.ConvertToUtf32((char)First, Str[1]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%----------------------------------------------------------------------------% | |
% vim: ft=mercury ff=unix ts=4 sw=4 tw=78 et | |
%----------------------------------------------------------------------------% | |
% File: string_encoding.m | |
% Copyright © 2014 Sebastian Godelet | |
% Main author: Sebastian Godelet <sebastian.godelet+github@gmail.com> | |
% Created on: Sun Jun 22 11:13:20 CEST 2014 | |
% Stability: low | |
%----------------------------------------------------------------------------% | |
% A little effort to implement UTF-16 support for strings. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@setlocal enabledelayedexpansion | |
@chcp 850 2>nul 1>nul | |
@set JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8 | |
@if "%~1" EQU "" @( | |
set grades=mercury --libgrades-exclude stseg --libgrades-exclude trseg | |
set grades=!grades! --libgrades-exclude pregen --libgrades-exclude memprof | |
set grades=!grades! --output-libgrades | |
) else ( | |
set grades=echo %* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for f in *.[ch]; do gvim -f +"syn on" +"run! syntax/2html.vim" +"wq" +"q" $f; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AlllUnicodeDigits { | |
public static void Main() | |
{ | |
var unicodeEncoding = new UnicodeEncoding(!BitConverter.IsLittleEndian, false); | |
Console.InputEncoding = unicodeEncoding; | |
Console.OutputEncoding = unicodeEncoding; | |
var sb = new StringBuilder(); | |
for (var codePoint = 0; codePoint < 0x10ffff; codePoint++) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ $# -eq 0 ]; then | |
exit 1 # the first argument *MUST* be the executed script | |
fi | |
if [ -x $1 ]; then | |
SHELL_SCRIPT=$(basename $0) | |
SCRIPT=$1 | |
mv -f $SCRIPT ${SCRIPT}.tmp | |
shift |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference path="bluebird.d.ts" /> | |
import Promise = require("bluebird"); | |
Promise.cast(8).then(x => console.log(x.toExponential())); | |
function delayer(time: number) { | |
var d = Promise.defer(); | |
setTimeout(_ => d.resolve, time); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addTableRow(jQtable){ | |
jQtable.each(function(){ | |
var $table = $(this); | |
// Number of td's in the last table row | |
var n = $('tr:last td', this).length; | |
var tds = '<tr>'; | |
for(var i = 0; i < n; i++){ | |
tds += '<td> </td>'; | |
} | |
tds += '</tr>'; |