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
<component name="libraryTable"> | |
<library name="GAE_SDK" type="python"> | |
<CLASSES> | |
<root url="file:///opt/google-cloud-sdk/platform/google_appengine" /> | |
<root url="file:///opt/google-cloud-sdk/platform/google_appengine/lib/django-1.5" /> | |
<root url="file:///opt/google-cloud-sdk/platform/google_appengine/lib/jinja2-2.6" /> | |
<root url="file:///opt/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.5.2" /> | |
<root url="file:///opt/google-cloud-sdk/platform/google_appengine/lib/protorpc-1.0" /> | |
</CLASSES> | |
<SOURCES /> |
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
// program_start | |
fd_log = open("logfile.log") | |
fn log(msg) { | |
fd_log.write(msg) | |
fd_log.flush() | |
} |
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
def get_by(module, params) do | |
Enum.find all(module), fn map -> | |
Enum.all?(params, fn {key, val} -> Map.get(map, key) == val end) | |
end | |
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
iex(1)> jump=4 | |
4 | |
iex(2)> s = Stream.unfold(0, fn x -> {x, x+jump} end) | |
#Function<1.133682015/2 in Stream.unfold/2> | |
iex(3)> items = [ "aba", "cate", "dood"] | |
["aba", "cate", "dood"] | |
iex(4)> Enum.zip(s, items) | |
[{0, "aba"}, {4, "cate"}, {8, "dood"}] |
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
in master: | |
# create and checkout new branch | |
git checkout -b my_feature_1 | |
# work | |
<my_feature_1> git commit | |
# I'm ready to push feature_1 | |
# check which remote you want to push to (in exemple below, origin) |
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
defp sign_in(%User{password_digest: password_digest, id: user_id}, password, conn) do | |
if checkpw(password, password_digest) do | |
conn | |
|> put_session(:current_user, user_id) | |
|> put_flash(:info, "Sign in successful!") | |
|> redirect(to: page_path(conn, :index)) | |
else | |
sign_in(nil, nil, conn) | |
end | |
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
defmodule Freshcards.Post do | |
use Freshcards.Web, :model | |
schema "posts" do | |
field :title, :string | |
belongs_to :user, Freshcards.User # right! | |
# belongs_to :user, User <-- wrong | |
timestamps | |
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
defmodule M do | |
def add(x, y) do | |
x + y | |
end | |
end | |
1 |> M.add(2) |> IO.puts #=> 3 | |
# add1 = 1|> add #=> illegal undefined function add/1 | |
# Em certas linguagens isto faria um currying que é uma aplicação parcial de 1 na função add |
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
### Grunt Dependencias ### | |
"envify": "~1.2.1", | |
"grunt": "~0.4.4", | |
"grunt-browserify": "~1.3.2", | |
"grunt-contrib-watch": "~0.6.1", | |
"grunt-env": "~0.4.1" | |
#Note que não faz o uglify! | |
#### Grunt #### | |
var fs = require('fs'); | |
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 Stuff do | |
def inlist([search_item|_tail], search_item), do: true | |
def inlist([_head|tail], search_item) , do: inlist(tail, search_item) | |
def inlist([], _), do: false | |
end | |
IO.inspect(Stuff.inlist([1,2,3],1)) |
NewerOlder