To produce a string a la '2015-03-25' for the current date
In Ruby:
require 'date'
d = Date.today
puts d.to_s
In Javascript:
for(i = 0; i < n_rows; i++) | |
{ | |
tmp = 0; | |
for(j = i + 1; j < n_rows; j++) | |
{ | |
tmp += prA[i*n_rows + j]*prX[j]; | |
} | |
y += prX[i]*2.0*tmp; | |
y += prX[i]*prX[i]*prA[i*n_rows + i]; | |
} |
void DImage::deskew(string filename, unsigned int angle) | |
{ | |
if (filename == "") | |
return; | |
std::cout << "Being called with filename " << filename << std::endl; | |
Mat img = imread(filename, CV_LOAD_IMAGE_GRAYSCALE); |
if(AllocConsole()) | |
{ | |
freopen("CONOUT$", "wt", stdout); | |
freopen("CONOUT$", "wt", stderr); | |
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), | |
FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED); | |
fprintf(stdout, "\n"); | |
fprintf(stdout, " stdout/stderr Console\n"); |
% From http://stackoverflow.com/questions/12657202/ | |
-export([first/3, first1/3]). | |
% My solution | |
first([E | Rest], Condition, Default) -> | |
case Condition(E) of | |
true -> E; | |
false -> first(Rest, Condition, Default) | |
end; | |
first([], _Cond, Default) -> Default. |
To produce a string a la '2015-03-25' for the current date
In Ruby:
require 'date'
d = Date.today
puts d.to_s
In Javascript:
# encoding: utf-8 | |
class Bar | |
def initialize(name) | |
@name = name | |
end | |
def hi | |
puts "HI #{@name}" | |
end |
#!/usr/bin/env elixir | |
# Convert an Elixir config.exs to an erlang sys.config | |
# | |
# Usage: elixir_to_sys_config config.exs > sys.config | |
# First argument is the Elixir config.exs file | |
# Writes to stdout | |
# You probably want to set MIX_ENV accordingly | |
# | |
# 2015 by Dan Swain, [email protected] |
iex(1)> KafkaEx.create_worker(:foo, uris: Application.get_env(:kafka_ex, :brokers), consumer_group: "bar") | |
14:53:54.712 [debug] Succesfully connected to "localhost" on port 9092 | |
14:53:54.714 [debug] Succesfully connected to "localhost" on port 9093 | |
14:53:54.716 [debug] Succesfully connected to "localhost" on port 9094 | |
{:ok, #PID<0.138.0>} | |
iex(2)> Enum.each(1..1000, fn x -> KafkaEx.produce("foo", 0, "bar#{x}") end) | |
:ok |
namespace erl thrash | |
typedef i64 UgeInt | |
const i32 MAX_THINGS = 42 | |
enum TacoType { | |
BARBACOA = 123, | |
CARNITAS = 124, | |
STEAK = 125, |
I hereby claim:
To claim this, I am signing this object: