Skip to content

Instantly share code, notes, and snippets.

Avatar

MihailJP MihailJP

View GitHub Profile
@MihailJP
MihailJP / hsp.xml
Created Jan 1, 2013
Notepad++ syntax highlighting definition file for Hot Soup Processor
View hsp.xml
<NotepadPlus>
<UserLang name="HSP" ext="hsp as" udlVersion="2.0">
<Settings>
<Global caseIgnored="yes" allowFoldOfComments="no" forceLineCommentsAtBOL="no" foldCompact="no" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments" id="0">00// 00; 01 02 03/* 04*/</Keywords>
<Keywords name="Numbers, additional" id="1"></Keywords>
<Keywords name="Numbers, prefixes" id="2">0x 0b $ %</Keywords>
@MihailJP
MihailJP / hsp.xml
Created Jan 1, 2013
Kate syntax highlighting definition file for Hot Soup Processor
View hsp.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<language name="Hot Soup Processor" section="Sources" version="1.00" extensions="*.hsp;*.as">
<highlighting>
<list name="keywords">
<item> await </item>
<item> break </item>
<item> continue </item>
<item> else </item>
<item> end </item>
@MihailJP
MihailJP / cobol.xml
Last active Jun 5, 2021
Kate syntax highlighting definition file for COBOL
View cobol.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd" [
<!ENTITY picsig "\bPIC(TURE)?(\s+IS)?\s+">
<!ENTITY verbs "\b(((END-)?(ACCEPT|ADD|CALL|COMPUTE|DELETE|DISPLAY|DIVIDE|EVALUATE|IF|MULTIPLY|PERFORM|READ|RECEIVE|RETURN|REWRITE|SEARCH|START|STRING|SUBTRACT|UNSTRING|WRITE))|ALTER|ASSIGN|CHAIN|CLOSE|CONTINUE|CONTROL|COPY|COUNT|ELSE|ENABLE|ERASE|EXIT|GENERATE|GO|GOBACK|IGNORE|INITIALIZE|INITIATE|INSPECT|INVOKE|MERGE|MOVE|OPEN|RELEASE|REPLACE|RESERVE|RESET|REWIND|ROLLBACK|RUN|SELECT|SEND|SET|SORT|STOP|SUM|SUPPRESS|TERMINATE|THEN|TRANSFORM|UNLOCK|UPDATE|USE|WAIT|WHEN)\b(?!-)">
<!ENTITY usages "\b(BINARY|BINARY-C-LONG|BINARY-CHAR|BINARY-DOUBLE|BINARY-LONG|BINARY-SHORT|COMP|COMP-1|COMP-2|COMP-3|COMP-4|COMP-5|COMP-X|COMPUTATIONAL|COMPUTATIONAL-1|COMPUTATIONAL-2|COMPUTATIONAL-3|COMPUTATIONAL-4|COMPUTATIONAL-5|COMPUTATIONAL-X|FLOAT-BINARY-16|FLOAT-BINARY-34|FLOAT-BINARY-7|FLOAT-DECIMAL-16|FLOAT-DECIMAL-34|FLOAT-EXTENDED|FLOAT-LONG|FLOAT-SHORT|FUNCTION-POINTER|INDEX|NATIONAL|PACKED-DECIMAL|PO
@MihailJP
MihailJP / gist:4246185
Created Dec 9, 2012
Immediate object as a static member
View gist:4246185
#include <iostream>
using std::cout; using std::endl;
// A class whose instance will be included as a member of a monostate class
class CContent {
public:
CContent() {cout << "CContent constructor" << endl;}
~CContent() {cout << "CContent destructor" << endl;}
void speak() {cout << "Bonjour le monde !" << endl;}
@MihailJP
MihailJP / ConstTest1.java
Created Dec 7, 2012
You cannot override a class (static) constant (Java)
View ConstTest1.java
class Parent {
static final int Val = 1;
public int getval() {
return Val;
}
}
class Child extends Parent {
static final int Val = 2;
}
@MihailJP
MihailJP / 1_wrong.cpp
Created Dec 7, 2012
You cannot override a class (static) constant
View 1_wrong.cpp
#include <iostream>
class Parent {
protected:
static const int val = 1;
public:
virtual int getval() {return val;}
};
class Child : public Parent {
@MihailJP
MihailJP / gist:4069788
Created Nov 14, 2012
Using wchar_t working with locale
View gist:4069788
#include <wchar.h>
#include <stdlib.h>
#include <locale.h>
int main() {
char* syslocale = getenv("LANG");
const wchar_t teststr[] =
L"僕と契約して、"
L"プログラマになってよ!";
setlocale(LC_ALL, syslocale);
@MihailJP
MihailJP / matrix.hpp
Created Oct 23, 2012
Matrix template (C++11 only!)
View matrix.hpp
#ifndef MATRIX_HPP
#define MATRIX_HPP
#include <array>
#include <initializer_list>
#define MTXTMP template <typename T, unsigned int rows, unsigned int cols>
/* Matrix class template */
MTXTMP class matrix {
@MihailJP
MihailJP / d_copy.lua
Created Oct 22, 2012
Shallow- and deep-copy of table in Lua
View d_copy.lua
function clone (t) -- deep-copy a table
if type(t) ~= "table" then return t end
local meta = getmetatable(t)
local target = {}
for k, v in pairs(t) do
if type(v) == "table" then
target[k] = clone(v)
else
target[k] = v
end
@MihailJP
MihailJP / test2038.c
Created Oct 8, 2012
Check if your time_t implementation will work after 2038
View test2038.c
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
int main () {
time_t time_num[5] = {(time_t)0x00000000, (time_t)0x7fffffff, (time_t)0x80000000, (time_t)0xffffffff,};
struct tm* parsed_time; unsigned int i;
printf("sizeof(time_t) is %d.\n", sizeof(time_t));
for (i = 0; i < 4; i++) {
parsed_time = gmtime(&(time_num[i]));