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
languages = { | |
"C": { | |
'main_file': "{bot}.c", | |
'nuke_globs': ["*.o", "{bot}"], | |
'compile': [ | |
System("gcc -O3 -c {file}", glob="*.c"), | |
System("gcc -O2 -lm -o {bot}", glob="*.o"), | |
], | |
'run': "./{bot}", | |
}, |
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
var f = function() {}; | |
f.prototype.food = { apples: 0, bananas: 0 }; | |
var f1 = new f(); | |
f1.food.apples++; | |
var f2 = new f(); | |
console.log(f2.food.apples); // 1 | |
This is because the food object is modified in-place, and both instances refer to the same object. |
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
// a.js | |
exports.message = 'hello world!'; | |
exports.b = require('./b'); | |
// b.js | |
var a = require('./a'); | |
module.exports = function() { return a.message; } |
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
var nextNumber = 0; | |
module.exports.getNumber = function() { | |
nextNumber += 1; | |
return nextNumber; | |
}; |
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
var http = require('http'), | |
qs = require('querystring'); | |
var body = qs.stringify({ method: 'system.connect' }); | |
var options = { | |
host: 'www.goworkit.com', | |
port: 80, | |
path: '/services/json/', | |
method: 'POST', | |
headers: { |
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
# Additional caching and such might be helpful for performance. | |
# Sass's regeneration only on changed files should work as long as the server provides the Last-Modified header | |
require 'net/http' | |
require 'time' | |
require 'sass' | |
module Sass | |
module Importers | |
# Importer which issues HTTP requests |
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 java.lang.*; | |
class HelloWorld { | |
public static void main(String[] args) { | |
System.out.println("Hello world!"); | |
} | |
} |
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 BananaMerchant { | |
private final BananaFactory bananaFactory; | |
private final ShippingAgent shippingAgent; | |
private final PricingBroker pricingBroker; | |
private final List<Banana> bananas; | |
private final Map<Integer, Customer> customerMap; | |
public BananaMerchant( | |
final BananaFactory bananaFactory, | |
final ShippingAgent shippingAgent, |
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
$ g++ -c monads.cc | |
monads.cc: In member function ‘lvector<B> Monad<lvector>::bind(lvector<A>, Function)’: | |
monads.cc:24: error: expected `;' before ‘it_a’ | |
monads.cc:26: error: ‘it_a’ was not declared in this scope | |
monads.cc:28: error: expected `;' before ‘it_b’ | |
monads.cc:28: error: ‘it_b’ was not declared in this scope | |
#include <string> | |
#include <vector> |
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 <string> | |
#include <vector> | |
template <template <typename> class M> | |
class Monad { | |
public: | |
template <typename A, typename B, typename Function> | |
static M<B> monad_bind(M<A> in, Function function); |
OlderNewer