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 edit(conn, %{ "edit" => newData }) do | |
#TODO: naprawic to | |
case Repo.one(User.unique_user(User, "login")) do | |
nil -> conn | |
|> put_flash(:error, "Błąd bazy danych") | |
result -> | |
if Map.get(newData, "password") == "" do | |
newData = Map.put(newData,"password", result.password) | |
end | |
if Map.get(newData, "avatar") == "" do |
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 show_details(conn, _params) do | |
name_param = Map.get(_params, "name") | |
permission_level = get_session(conn, :role) | |
case permission_level do | |
User.student -> | |
session_login = get_session(conn, :login) | |
IO.inspect(session_login) | |
IO.inspect(name_param) | |
case name_param do | |
^session_login -> |
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
/* | |
Zrodla : | |
http://www.cplusplus.com/reference/stack/stack/push/ | |
http://www.cplusplus.com/reference/string/string/ | |
Opublikowano na pastebin.com | |
Dlaczego unsigned ? - bo nie niesie za soba, bo wymaga bardzo malo pamieci | |
Dlaczego stack ? - bo chcialem sprawdzic jak to dziala |
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 Hangman.CategoryController do | |
use Hangman.Web, :controller | |
alias Hangman.Category | |
def create(conn, %{ "category" => params }) do | |
IO.inspect(params) | |
a = Category.changeset(%Category{},params) | |
Repo.insert(a) | |
text(conn, a.valid?) |
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 Hangman.MasterCatController do | |
use Hangman.Web, :controller | |
alias Hangman.MasterCat | |
def index(conn, _params) do | |
query = from p in MasterCat, | |
select: p | |
a = Repo.all(query) |
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
package model | |
import play.api.data.Form | |
import play.api.libs.json.Json | |
import model.SkillFormats.skillRecordFormat | |
import play.api.data._ | |
import play.api.data.Forms._ | |
object UserFormats { | |
implicit val userForm = Form( |
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 Andrzej do | |
def getData(s), do: String.replace(IO.gets(s),"\n","") | |
def gIndex(list,elem), do: Enum.find_index(list, fn x -> x == elem end) | |
def testCombinator (listS) do | |
x = [" pierwsza forma "," druga forma "," trzecia forma ", " polski "] | |
listP = List.zip([x,listS]) | |
Enum.map(listS, fn a -> Enum.map(listP, | |
fn {b,c} -> | |
unless gIndex(listS,a) == gIndex(x,b) do | |
getData(a <> "=>" <> b) == c |
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
package objsets | |
import common._ | |
import TweetReader._ | |
/** | |
* A class to represent tweets. | |
*/ | |
class Tweet(val user: String, val text: String, val retweets: Int) { | |
override def toString: String = |
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
selectMaps($()).map { elem => | |
elem.map { jsValue => | |
jsValue.validate[Level].get | |
}: List[Level] | |
}.collect { | |
case (list: List[Level]) => Ok(views.html.levelChooser(list)) | |
} |