Skip to content

Instantly share code, notes, and snippets.

View Kotauror's full-sized avatar
🌞

Justyna Jurkowska (Zygmunt) Kotauror

🌞
  • London (UK) / Kraków (PL)
  • 00:11 (UTC +02:00)
View GitHub Profile
@Kotauror
Kotauror / srand.md
Last active May 14, 2019 09:09
srand in RSPEC stubbing.

srand in RSPEC stubbing.

Without further ado - some thoughts on how to use srand in RSPEC testing. Example at the end.

How does the srand work line by line.

Line Input Output
1 srand(4) 281462327676453734791076087004180619592
@Kotauror
Kotauror / ruby_postgres_magic.md
Created February 13, 2018 21:23
Ruby + Postgresql - understanding the magic. This is my early attempt at understanding the magic which makes my ruby app work and connect to postgresql database.

Ruby + Postgresql - understanding the magic.

This is my early attempt at understanding the magic which makes my ruby app work and connect to postgresql database.

Program at the moment:

CONTROLLER :

app.rb

require 'sinatra/base'
@Kotauror
Kotauror / Ruby_to_JS.md
Created February 19, 2018 21:42
FizzBuzz in Javascript line by line.

FizzBuzz in Javascript line by line.

With comparisons to Ruby.

function FizzBuzz() {

}
  • First we create a function FizzBuzz that takes no arguments.
@Kotauror
Kotauror / events.md
Last active February 26, 2018 21:52
How to make an HTML form interact with JS.

Events in jQuery - How to make an HTML form interact with JS.

Caution: MINDBLOWING!

[[[ EDIT ----- I've found an easier way to get the information from form - update at the end ]]]

I would like to share with you a thing that I've learned today. Thank you Sofie and Matt for helping me understand that.

Let's get straight into the problem. I have a static html website with (among others) a form to increase a temperature.

@Kotauror
Kotauror / notes.md
Created February 26, 2018 21:16
Introduction to sequelise / node and other js stuff.

Sequelize - basic notes.

This note contains some remarks on my first (and painful) attempt to switch from ruby+postgres to javascript+postgres.

// thanks to Marcus & Ben for the introduction.

SETUP:

$ npm init -y
@Kotauror
Kotauror / Promise_object.md
Last active March 1, 2018 18:50
Promise object in JS

Promise object in JS

This note is my attempt at explaining the idea of a promise object in JS.

Learning javascript as the second language, right after Ruby, is sometimes hard, as the path from zero to JS-hero is full of new - unknown to Ruby - concepts. One of them is a promise object that I happened uppon while creating my first end-to-end JS application.

Background

For an MVP I was supposed to write an application which:

  • allows user to add posts (listings) on the website,
@Kotauror
Kotauror / playing_with_functions_js.md
Last active March 6, 2018 20:56
Playing with functions in JS

Playing with functions in JS

This note's purpose is to solidify knowledge on how to construct and use different types of functions in JS.

Constructors

Constructors are functions which allow to share behavior by their instances. They're basically like classes in Ruby.

var Party = function() {
@Kotauror
Kotauror / limiting_scope.md
Last active March 6, 2018 19:34
Limiting the scope in JS by using module pattern

Limiting the scope in JS by using module pattern

JS, unlike Ruby, doesn't have classes to separate concerns or the concept of private method. In order to limit the scope of of our code, we can use the module pattern that will make some code available while keeping other parts of code hidden.

Code basis

Question.js

@Kotauror
Kotauror / setting_up_js_testing_framework.md
Last active March 6, 2018 19:47
Setting up a testing framework in JS

Setting up a JS testing framework from scratch.

Without any libraries.

// This note is a summary of work of the Moisty team, week 7 of Makers Academy. Thank you Laura, Daniel, Josue, Josh and Terry.

// Check out the full repo here: https://github.com/lwkchan/moisty.

Files

@Kotauror
Kotauror / further_JS_functions.md
Last active March 7, 2018 10:04
Further playing with JS functions

More notes on functions in JS

Putting () at the end of an attribute that stores a function.

var Game = function() {};

Game.prototype.beforeGame = function(callback) {
 this.runBeforeGame = callback;
};