Skip to content

Instantly share code, notes, and snippets.

View qmmr's full-sized avatar

Marcin Kumorek qmmr

View GitHub Profile
@qmmr
qmmr / main.py
Last active February 14, 2019 11:13
Homework Assignment #1: Variables
"""
pirple.com/python
Homework #1: Variables
The purpose of this file is to get familiar with the variables and how we assign different values to them.
Additionally you get to know how single and multiline comments work in Python.
Run this file from terminal: python3 main.py
"""
@qmmr
qmmr / main.py
Last active February 17, 2019 13:42
Homework Assignment #2: Functions
"""
pirple.com/python
Homework Assignment #2: Functions
Create three functions that return song attributes.
Bonus: Create a function that returns Boolean value.
"""
@qmmr
qmmr / curl.md
Created October 20, 2018 14:23 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@qmmr
qmmr / all_the_thingz.md
Last active May 22, 2018 07:54
Learning Python 3

Code for integer division in Python 2:

3 / 4

Code for float division in Python 2:

3 / 4.

Code for integer division in Python 3:

@qmmr
qmmr / index.js
Created December 4, 2017 08:43 — forked from zkat/index.js
npx is cool
#!/usr/bin/env node
console.log('yay gist')
@qmmr
qmmr / script.js
Last active January 13, 2017 13:28
Detect mobile browsers
(
function(a,b){
if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|k
@qmmr
qmmr / README.md
Created August 9, 2016 08:11
React Components - guide to create reusable components

React Components - guide to create reusable components

  • Do not name your components after the part of state they connect to.
  • Do not name your components for the role they play in YOUR application.
  • A component should be given ONLY the props it requires. This structure should be flat.
  • Props should not be named according to the application state that gets passed in. Instead, they should be named according to their usage within the component itself.
  • Composition is superior to import statements at the top and is the primary mechanism which allows your component to focus on doing ONE thing. Use it wherever, and whenever you can.

Here are some common ways presentational components “know” about a product:

{
"extends": ["airbnb", "plugin:react/recommended"],
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
@qmmr
qmmr / fibonacci.es5.js
Last active May 30, 2016 10:21
Fibonacci sequence using generator
function fibonacci(max) {
var prev = 0
var curr = 1
var temp = 0
var i = 0
var out = []
for (; prev < max; i++) {
out.push(prev)
temp = prev