25
votes
0answers
313 views

Capture the notion of invertible functions

I find sometimes it is useful to capture the notion of invertible functions. The idea is that if two functions f :: a -> b and ...
12
votes
0answers
205 views

Yet another 'any' class implementation, named 'some'

This is a follow-up of 'any' class implementation. After posting my answer, I kept working on the code towards parameterizing with respect to memory management as I had promised. I ended up in some ...
12
votes
0answers
240 views

Factor script to change case of all filenames in a directory

In the absence of a full-fledged tutorial, I am teaching myself to program in the Factor language by writing a bunch of functions that I will eventually use in command-line scripts. One common ...
10
votes
0answers
2k views

Fluent LinkedIn REST API client interface design

There is a handful of LinkedIn clients written in C# on the NuGet package library, but afaict most only do authentication via LinkedIn. I found a couple which offer a linkedin rest api interface. Of ...
8
votes
0answers
568 views

boost::any replacement with std::unique_ptr support

I needed a boost.any look-a-like, that could handle a std::unique_ptr. I came up with this. Please provide some C++11 criticism. ...
7
votes
0answers
64 views

Storing global styles and utilizing them throughout view controllers

Assuming an app has many display styles, fonts, colors, etc., and that we never want to hardcode values, I've created an AppVariables object that houses properties ...
7
votes
0answers
99 views

Sequencially remove members that “repelled” by previous members

I was working on a project that need to remove extra data such that the remains are not "too close" to each other, and the algorithm should be as generalize as possible. To have more general usage, I ...
7
votes
0answers
91 views

PHP-framework with MVC architecture and Active Record pattern for the DB management

I tried to create the PHP-framework, with no experience in the task like this: Folders: ...
7
votes
0answers
93 views

Recursively using reflection to merge fields

I'm using the Observer pattern to notify my UI that the object they're representing has changed. Also, I'm refreshing this object from the interwebs. Therefore, I'm ending up with two instances ...
7
votes
0answers
132 views

Bash script to clone all public repos or gists for a specified user, optionally to a directory of choice

I wrote this script as a way to backup and/or download quickly a set of repos or gists from a user. I don't have any major concerns but I'm a noob at bash scripting, and I've been scouring the ...
7
votes
0answers
81 views

Runtime expression autocompletion

I've written a function that can be used at runtime to suggest how the provided incomplete Lua expression can be completed so that it would make sense (that is, it would evaluate to a non-nil value). ...
7
votes
0answers
107 views

Out of order class resequencer

I got bored recently and wrote a tool to re-order out of order classes in Python files. This can occur with some auto-generation code tools for databases and the like; these files can sometimes be ...
7
votes
0answers
174 views

Lua OOP and classically-styled prototypal inheritance

I want to do some object-oriented programming in Lua, and I decided on something like this: ...
7
votes
0answers
229 views

Portable CMake script

I'm trying to write a portable CMake script for a simple Qt application. The target platforms are Win and Mac OSX. But as you can see, it's quite a monster already. Are there any CMake profs? Can you ...
7
votes
0answers
1k views

JSON Serializer

Carrying on from: Yet another C++ Json Parser Yet another C++ Json Parser (Recursive) All the code is available from git hub: ThorsSerializer but only reviewing a small section here. The idea is ...
6
votes
0answers
57 views

Basic snake game

Coming from a Java background, this is my first JavaScript-only game. I'm looking for some advice on what to improve. Also, I'm having trouble when it comes to program design. Sometimes I don't ...
6
votes
0answers
94 views

Shift and merge numbers as in 2048 game code

I started to learn Rust last night. Given its parallelization capabilities, I thought a good starting point would be porting my C++ AI for 2048 to Rust. This is the function implementing the shift ...
6
votes
0answers
214 views

Low-lock Multi-threading Implementation

I'm designing in my spare time a game engine (for fun, not so much for profit, haha). I wanted to design the 'core pipeline' as efficiently as possible. Having a quad-core CPU, I decided to take ...
6
votes
0answers
254 views

A program to proxy MDNS requests to the DNS server

I wrote a program to proxy MDNS requests in local network to the DNS server. This is useful because in some private networks, host names ending in ".local" are configured in the DNS server. But ...
6
votes
0answers
360 views

Connect Four AI (Minimax) in Clojure

I wrote a Connect Four game including a AI in Clojure and since I'm rather new to Clojure, some review would be highly appreciated. It can include everything, coding style, simplifications, etc. But ...
6
votes
0answers
2k views

Writing better code for validating a credit card

I recently created an extension which detects the type of credit card based on the numbers entered in and formats it. I am using Luhn Algorithm for validating credit card numbers and I am using jQuery ...
6
votes
0answers
186 views

Shepard Tone stream generation in Clojure

This is my work to generate an infinite Shepard Tone. It is written in Clojure and works by generating repeating streams of incrementing frequencies, converting those to values on a sine wave and then ...
6
votes
0answers
157 views

Concurrency limit map in Go

Please someone who knows locks, mutexes, and Go, review the following code. Task: per host concurrency limits for web crawler (map[string]Semaphore). I considered chan struct{} (chan bool) approach, ...
6
votes
0answers
876 views

Haskell: Use of the ST Monad and Vectors

Inspired by a stack overflow question, I decided to take a crack at the Google Code Jam's Minimum Scalar Product problem as an opportunity to practice my haskell. I'm not claiming any algorithmic ...
5
votes
0answers
28 views

Unhandled Exception handler that captures a screenshot

So, whether you're still in the development stages or your app is already on the app store, you always hope your app isn't crashing. But if it is, you want to be sure you've got good crash reports, ...
5
votes
0answers
47 views

Reduce duplicate sequences

I am writing a copy paste detector using esprima.js and Hmm. This particular function checks a number of sequences and reduces them. Due to the parsing I might have 2 sequences with the same piece of ...
5
votes
0answers
68 views

Finding all paths from a given graph

I need to find all paths from a given graph. I can do that for now, however my recursive code is not efficient and my graphs are very complicated, hence I need a better algorithm. ...
5
votes
0answers
21 views

Averaging a set of percentages between certain important levels

I have a function that averages a set of percentages (in column E) between certain importance levels (column A, in this case between ...
5
votes
0answers
157 views

Puzzle game with sequence numbers

I am currently developing a puzzle game that has sequence numbers. The player has to fill the grid with sequence numbers in ascending order. Starting from 1 the player can move horizontally or across ...
5
votes
0answers
43 views

CUDA - 3D Vector kernel

I designed this CUDA kernel to compute a function on a 3D domain: p and Ap are 3D vectors that are actually implemented as a ...
5
votes
0answers
55 views

Filtering queries based on the current user state

I have a Symfony2 project. I have an Entity Asset which can have relations with Category. I store a ...
5
votes
0answers
140 views

Translating CFRM algorithm from Java to Clojure, + improving performance

Counterfactual Regret Minimization is an algorithm that can be used to find the Nash Equilibrium for games of incomplete information. I have tried to adapt the exercise from here: ...
5
votes
0answers
70 views

Reading Intervals from command line

I want to parse a command line using boost.program_options. Most of my command line arguments will be intervals, which I could implement as something like ...
5
votes
0answers
59 views

Garrys Mod custom spectate player

Been making my own scoreboard and needed a custom spectate function for it so I made this: ...
5
votes
0answers
133 views

Most elegant variadic functor

Question Suppose we have two sorts of classes an input class Input defines a type result_type defines ...
5
votes
0answers
74 views

Roman numeral kata in Elixir

I'm new to Elixir, and in order to learn the syntax, I'm doing a roman numeral kata which converts a decimal number into roman numeral. I would appreciate any feedback you have. ...
5
votes
0answers
2k views

Lock-free multiple-consumer multiple-producer queue

The code below implements an intrusive lock-free queue that supports multiple concurrent producers and consumers. Some features: Producers and consumers work on separate ends of the queue most of ...
5
votes
0answers
566 views

Merge sort in Scheme

...
5
votes
0answers
109 views

Concatenative PostScript library

As a part of picking up concatenative programming, I decided to implement the common concatenative operations in PostScript. Here is my attempt at implementing some of the words in other concatenative ...
5
votes
0answers
1k views

QJsonView: A QWidget-based json explorer for Qt

Abstract I'm developing applications using Qt which highly make usage of the JSON language to communicate, store and load data of different types. I often need a simple viewer similar to the Firebug ...
5
votes
0answers
302 views

Basis of custom C++ serialization lib

I know it's been done a million times already, but I couldn't find a serialization library to suit my needs. This is the very basis of what I came up with. I know the code is ugly and unstructured, so ...
5
votes
0answers
222 views

luaproxy, (semi) automatic exportation of C++ classes to Lua

I'm writing a library that would ease the exportation of C++ classes (that is the definition of their members) to Lua. It originated from the need of tidying up the code for a server mod of a open ...
5
votes
0answers
914 views

Fastest function for TCanvas.CopyRect

I want to scale some sub images from an original image. I need to use TCanvas.CopyRect function for about 5,000 times and it is very slow (from a simple BMP image). ...
5
votes
0answers
77 views

Timeoutable computations module

Defines a simple module for timeoutable computations, with the ability to return arbitrary intermediary results on timeout or the final value otherwise. It also allows default return values. The ...
5
votes
0answers
291 views

Use of external memory or a custom allocator

I'm creating a class which uses a custom buffer. I want to offer the possibility to pass an external memory address (for higher interoperability between languages) or (for convenience) to specify a ...
5
votes
0answers
589 views

C++ API for interfacing with Lua

I wanted a good way to move objects back and forth between Lua and C++, and I didn't want to use anything like LuaBind or the other available libraries I could find, so I instead wrote this. It's ...
4
votes
0answers
16 views

Mobile touch menu

I want to make a menu-item which: Reveals a drop-down submenu, when the item is hovered (using a mouse) or touched (using a touch-screen). Lets you click on a link in the submenu, while the submenu ...
4
votes
0answers
47 views

Merging overlapping/intersecting string vectors

I am trying to merge overlapping/intersecting sets given as a list of string vectors below in R (my actual data set has thousands of such sets). The overlap/intersection is based on the ...
4
votes
0answers
87 views

Is this pass-by-reference of a shared_ptr correct?

I'm writing a scene graph library in C++ and I'm currently designing the parent-child relations. I decided to use shared pointers for parent-to-child-relations and weak pointers for child-to-parent ...
4
votes
0answers
29 views

Snake Game in Dart

First project in Dart - looking for style tips. I feel like I'm writing it a bit like Java, and would like to learn how to write dart-y dart. Also - what's the convention on multiple files in a ...

15 30 50 per page