Underscore example:
_.each([1, 2, 3], function(num) { alert(num); });
def output name=((default=true); "caius") | |
puts "name: #{name.inspect}" | |
puts "default: #{default.inspect}" | |
end | |
output | |
# >> name: "caius" | |
# >> default: true | |
output "avdi" |
#!/bin/bash | |
echo "Generating an SSL private key to sign your certificate..." | |
openssl genrsa -des3 -out myssl.key 1024 | |
echo "Generating a Certificate Signing Request..." | |
openssl req -new -key myssl.key -out myssl.csr | |
echo "Removing passphrase from key (for nginx)..." | |
cp myssl.key myssl.key.org | |
openssl rsa -in myssl.key.org -out myssl.key |
#include "mruby.h" | |
#include "mruby/string.h" | |
#include "mruby/array.h" | |
mrb_value | |
migrate_simple_value(mrb_state *mrb, mrb_value v, mrb_state *mrb2) | |
{ | |
mrb_value nv; /* new value */ | |
const char *s; | |
int len; |
# Change the path to match the path to your machine. | |
$mrb_path = File.expand_path("~/src/mruby") | |
$mrbc = File.join($mrb_path,"/bin/mrbc") | |
task :default do | |
# dumps the Ruby file to disk | |
File.open("mandelbrot.rb", "w"){|f| f << mandelbrot_ruby_code } | |
# creates the .c file containing mandelbrot char array for the bytecode | |
`#{$mrbc} -Bmandelbrot_bytecode ./mandelbrot.rb` | |
example_file = wrapper_code(File.read("./mandelbrot.c")) |
Today, I released the new version of MessagePack for Ruby!
I rewrote all the code and achieved significant performance improvement, especially for serialization. I compared the new version to the old version (v4) using ruby-serializers benchmark, and the new version is faster for all data sets including Twitter, Image, Integers, Geo and 3D model.
class GitHub | |
class << self | |
def download_file_to_string(github_token, setup={}, raw=true, link=nil) | |
if link | |
url = link | |
else | |
sql_repo_name = setup['repo_name'] | |
sql_repo_owner = setup['repo_owner'] | |
# URI join won't make it: |
https://www.gnu.org/licenses/gpl-3.0.en.html | |
GNU GENERAL PUBLIC LICENSE v3 |
#!/bin/bash | |
mkdir -p /opt/bin | |
curl -L `curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r '.assets[].browser_download_url | select(contains("Linux") and contains("x86_64"))'` > /opt/bin/docker-compose | |
chmod +x /opt/bin/docker-compose |