- Make sure you have TDM-GCC on your Path.
- Download a build of dmake and put it on your path https://code.google.com/a/apache-extras.org/p/dmake/downloads/detail?name=dmake-win32-4.12.zip&can=1&q=
- try install something with complex dependency cpan reload index cpan install Devel::REPL
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
#include <iostream> | |
using namespace std; | |
typedef void(*action_t)(void); | |
struct Foo | |
{ | |
virtual void a() {cout << "a" << endl;} | |
virtual void b() {cout << "b" << endl;} | |
virtual ~Foo() {} |
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
#include <iostream> | |
#include <memory> | |
using namespace std; | |
// http://stackoverflow.com/questions/1008019/c-singleton-design-pattern | |
class Singleton | |
{ | |
public: | |
static Singleton& instance() | |
{ |
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
// convert a date to timestamp as if it is a UTC date | |
// in other words used to remove local timezone info and fake everything as UTC | |
// must beware the funky api naming | |
// workaround js UTC date things | |
// the general rule is treat date as naive datetime with no timezone info | |
// using UTC timezone is better since it won't change based on user's computer location | |
function asUTCTimestamp(date) { | |
return Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), | |
date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()); |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#define NAMEMAX 32 | |
/* http://www.reddit.com/r/dailyprogrammer/comments/1kphtf/081313_challenge_136_easy_student_management/ */ | |
int main() { | |
int row, cnt, ix, jx, *bufs; | |
char *names; | |
float *avgs, total_sum; | |
scanf("%d%d", &row, &cnt); |
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
import stat | |
from os import path, rmdir, remove, chmod, walk | |
from shutil import rmtree | |
def force_rmtree(root_dir): | |
''' | |
rmtree doesn't work when no write bit in linux or read-only in windows | |
force_rmtree recursively walk, do chmod and then remove | |
''' | |
for root, dirs, files in walk(root_dir, topdown=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
from StringIO import StringIO | |
def kvparse(s): | |
sin = StringIO(s) | |
d = {} | |
c = None | |
# workaround the nonlocal c by assignment everytime | |
def _consume(): | |
return sin.read(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
#include <iostream> | |
#include <WinSock2.h> | |
#include <WS2tcpip.h> | |
using namespace std; | |
// write a string to connected browser and exit | |
int main() { | |
WSADATA wsa; | |
if (WSAStartup(MAKEWORD(1, 1), &wsa) != 0) { | |
cerr << "WSAStartup failed." << endl; |
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
/* | |
* The scanner definition for COOL. | |
*/ | |
/* | |
* Stuff enclosed in %{ %} in the first section is copied verbatim to the | |
* output, so headers and global definitions are placed here to be visible | |
* to the code in the file. Don't remove anything that was here initially | |
*/ | |
%{ |
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
/** | |
* Fixed 2D Map, any out of bound reads returns empty, while out of bound | |
* writes will raise an error. | |
*/ | |
private class FixedArrayImpl<T> | |
{ | |
public var array : Array<T>; | |
public var size : Int; | |
public var empty : T; |