Skip to content

Instantly share code, notes, and snippets.

View tonini's full-sized avatar
💭
I may be slow to respond.

Samuel Tonini tonini

💭
I may be slow to respond.
View GitHub Profile
@tonini
tonini / config.yml
Last active December 15, 2015 12:38
# Doctrine Configuration
doctrine:
dbal:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
mappings:
# An array of mappings, which may be a bundle name or something else
mapping_name:
mapping: true
type: ~
dir: ~
alias: ~
prefix: ~
is_bundle: ~
(defun tonini-load-cabbage-project-settings ()
(let ((project-setting-file (concat (cabbage-project-root) ".cabbage")))
(when (file-readable-p project-setting-file)
(load project-setting-file))))
(add-hook 'cabbage-after-project-hook 'tonini-load-cabbage-project-settings)
;; Run hook
(defun cabbage-project-ido-find-project ()
(defun cabbage--run-single-ruby-file ()
(interactive)
(let* ((name (file-name-nondirectory (car (split-string (buffer-file-name)))))
(name-buffer (format "*%s*" name)))
(if (get-buffer name-buffer)
(kill-buffer name-buffer))
(ruby-compilation-run (buffer-file-name))))
Special Form: let (bindings...) forms...
This special form binds variables according to bindings and then evaluates all of the forms in textual order. The let-form returns the value of the last form in forms.
Each of the bindings is either (i) a symbol, in which case that symbol is bound to nil; or (ii) a list of the form (symbol value-form), in which case symbol is bound to the result of evaluating value-form. If value-form is omitted, nil is used.
All of the value-forms in bindings are evaluated in the order they appear and before any of the symbols are bound. Here is an example of this: Z is bound to the old value of Y, which is 2, not the new value, 1.
(setq Y 2)
=> 2
(let ((Y 1)
(Z Y))
public function test_admin_login()
{
$password = 'admin';
$admin = AdminFactory::create(["password" => $password]);
$this->visit("/admin");
$this->fillField("_username", $admin->getUsername());
$this->fillField("_password", 'admin');
$this->pressButton('Anmelden');
public function assertPageNotContainsText($text)
{
$this->assertTrueWithoutExcpetion(function() use ($text) {
$this->assertSession()->pageTextNotContains($text);
});
}
(defstruct person
name
age
sex)
; The assignments have to be in the same order as the slots in the defined struct
(setq sam (make-person :name "Samuel Tonini" :age 32 :sex 'male ))
(person-name sam) ; Samuel Tonini
(person-age sam) ; 32
(defmacro inc (var)
(list 'setq var (list '1+ var)))
(defmacro inc (var)
(list 'setq var (list '1+ var)))