Callback is facility to save a piece of code so that it may be invoked later in the current environment (Typically in response to an event)
3
votes
1answer
69 views
Prime Numbers Store
Problem definition:
Lets say we need to create a store for selling prime numbers.
Users enter the store and ask to buy a number.
If the number asked is a prime number,
1.1. then it's either ...
1
vote
1answer
32 views
my first jquery/json
This is my first use of jquery and json so would be grateful for any feedback please.
Background - this is on a job listing site and it has a Linkedin apply button plugin - this provides for a ...
3
votes
2answers
55 views
Passing Context in CoffeeScript
I'm trying to migrate from JavaScript to CoffeeScript. However I'm not sure about the best way to optimize the code generated by js2coffee.
Below is the original JavaScript source :
var async = ...
4
votes
1answer
102 views
Collection of Actions
I am trying to create a class to queue up a series of commands. (Not really a queue as events happen based on time). Each command has a callback (Action) that get's called. However, each Action has a ...
1
vote
1answer
115 views
Calling a function when all asynchronous calls complete
Below is a simplified version of some code I am using to execute a function after all asynchronous calls complete. Is this a reasonable piece of code? It seems to work. Nothing would break if ...
1
vote
1answer
110 views
Improve on an after_create callback with database queries - Ruby on Rails
First, some background. I have a Payment model that has_many :subscriptions. When a user pays (creates a new payment), I have an after_create callback that adds the newly created @payment.id to ...
1
vote
1answer
137 views
How to fix retrieval of receive data - very basic socket library in C
I am trying to learn C and have written a very basic socket library listed below. I would be interested in any general design and coding comments.
Note that at this stage I am not bothered about ...
3
votes
1answer
165 views
“Piping” from a callback to an Iterator
My project has a central concept of a Callback<T> which is defined very simply:
public interface Callback<T> {
void call(T item) throws Exception;
}
This is used to enforce correct ...
2
votes
2answers
136 views
Ruby Callback System
Version 1
I need a way to store and retrieve callbacks in Ruby. So I made a Callbacks class. Any suggestions would be greatly appreciated, thank you!
class Callbacks
def initialize
# name: ...
0
votes
1answer
863 views
Efficient implemetation of AlertDialog callback in Android
One day I realised that my Android project utilizes AlertDialogs here and there in very ineffective way. The heavily duplicated portion of code looked like this (actually, copied and pasted from some ...
2
votes
1answer
132 views
jQuery callbacks optimization
I have a lot of repeatable blocks of code and want to optimize/simplify them:
function animationInit() {
content = $('#content')
.bind('show',function(event, f) {
...
6
votes
1answer
216 views
Do nothing lamda…
$privilegeStrings = array_filter($privileges, function ($s) { return is_string($s); } );
Is there a better way to specify that I want just the string values in the given array?