This file contains hidden or 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
/* | |
Basic Golang struct embedding example | |
Try it here: https://play.golang.org/p/HGfzu4m6AB8 | |
*/ | |
package main |
This file contains hidden or 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
/* | |
Duck typing in golang example. | |
You can try it here: https://play.golang.org/p/kHRnpmA206r | |
*/ | |
package main |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
# Pop item at index i from list. Returns (item,new_list) | |
def pop2(l,i): | |
l1 = l[0:i] | |
l2 = l[(i+1):] | |
return (l[i],l1+l2) | |
def solve(numbers,goal): | |
solutions = [] | |
for i in range(len(numbers)): | |
(num,numbers2) = pop2(numbers,i) |
This file contains hidden or 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
defmodule TokenHolder do | |
require Logger | |
def start_link(user,passwd) do | |
Agent.start_link(fn -> | |
tok_time = get_token user, passwd | |
{user,passwd,tok_time} | |
end, name: __MODULE__) | |
end |
This file contains hidden or 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
# OpenCL in R example | |
# | |
# Kernel "gpu.sum" sums two vectors. | |
# | |
# Please note that in R OpenCL library: | |
# | |
# 1. the first argument must be the output vector | |
# 2. the second argument must be the length of the output | |
# 3. you must convert the input vectors to the right type ("as.double" here) | |
# |
This file contains hidden or 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
defmodule SafeCode do | |
def compile code do | |
# we can use [existing_atoms_only: true] here | |
{:ok, qcode} = code |> Code.string_to_quoted() | |
unless safe? qcode do | |
raise "Code is unsafe" | |
else | |
qcode |> Code.compile_quoted | |
end |
This file contains hidden or 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
## This is a quickstart tutorial for PureScript. Unlike with other tutorials, you don't need | |
## any build-manager (Grunt etc.) installed globally. We will use locally-installed Gulp. | |
## | |
## Prerequisites: | |
## - cabal (Haskell package manager) | |
## - npm (Node package manager) | |
## You will find both of them in your OS' repository. | |
## install PureScript compiller |
This file contains hidden or 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
$ gcc48 -I /usr/local/include -L/usr/local/lib -lboost_program_options boost_test.cpp | |
/usr/local/bin/ld: /tmp//ccauzjzJ.o: undefined reference to symbol '_ZSt17__throw_bad_allocv' | |
//usr/lib/libc++.so.1: error adding symbols: DSO missing from command line | |
collect2: error: ld returned 1 exit status | |
$ /usr/bin/c++ -I /usr/local/include -L/usr/local/lib -lboost_program_options boost_test.cpp | |
$ ./a.out --help | |
Basic Command Line Parameter App | |
Options: |
This file contains hidden or 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
--- src/cpp/core/CMakeFiles/rstudio-core.dir/r_util/RSessionLaunchProfile.cpp.o --- | |
/usr/local/bin/cmake -E cmake_progress_report /usr/ports/local/rstudio/work/.build/CMakeFiles | |
[ 30%] Building CXX object src/cpp/core/CMakeFiles/rstudio-core.dir/r_util/RSessionLaunchProfile.cpp.o | |
cd /usr/ports/local/rstudio/work/.build/src/cpp/core && /usr/bin/c++ -DBOOST_ASIO_DISABLE_KQUEUE -DBOOST_ENABLE_ASSERT_HANDLER -D_FORTIFY_SOURCE=2 -O2 -pipe -fstack-protector -fno-strict-aliasing -O2 -pipe -fstack-protector -fno-strict-aliasing -isystem /usr/local/include -I/usr/ports/local/rstudio/work/rstudio-rstudio-1c6c7bd/src/cpp/core/include -I/usr/ports/local/rstudio/work/.build/src/cpp/core -Wall -pthread -Wformat -Wformat-security -fstack-protector --param ssp-buffer-size=4 -pie -fPIE -o CMakeFiles/rstudio-core.dir/r_util/RSessionLaunchProfile.cpp.o -c /usr/ports/local/rstudio/work/rstudio-rstudio-1c6c7bd/src/cpp/core/r_util/RSessionLaunchProfile.cpp | |
c++: warning: argument unused during compilation: '-pie' | |
In file inclu |