Skip to content

Instantly share code, notes, and snippets.

View wjurkowlaniec's full-sized avatar
🎹

Wojtek Jurkowlaniec wjurkowlaniec

🎹
View GitHub Profile
@wjurkowlaniec
wjurkowlaniec / mailing.py
Last active August 29, 2015 13:56
Django mailing made easy
# -*- coding: utf-8 -*-
from django.core.mail import send_mail, mail_managers, EmailMultiAlternatives
from django.template.loader import render_to_string
from django.conf import settings
class Mailing:
path_prefix = 'mail/'
path_suffix = '.html'
prefix_title = u"TITLE BEGINNING - "
//get VALUE/TEXT of select from html, to insert in format ('val','text'),
$('#SELECT_ID').children().each(function(index){console.log("('"+$(this).val() + "', '" + $(this).text()+ "'),");})
from django.contrib.admin import FieldListFilter
from django.utils.translation import ugettext as _
class ActiveValueFilter(FieldListFilter):
"""list_filter which displays only the values for a field which are in use
This is handy when a large range has been filtered in some way which means
most of the potential values aren't currently in use. This requires a
queryset field or annotation named "item_count" to be present so it can
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
</head>
<body>
<h1>Generowanie offline PIN Enko</h1>
<h2>Wprowadź numer wozaka</h2>
<input type="text" placeholder="Numer ID wozaka " id="pin_input">
@wjurkowlaniec
wjurkowlaniec / log.sh
Created September 12, 2022 21:29
Make code review from code on master/main
(base) ➜ gitgit git:(master) ✗ git commit -m "siema"
On branch master
Initial commit
Untracked files:
(use "git add <file>..." to include in what will be committed)
plik.txt
nothing added to commit but untracked files present (use "git add" to track)
import asyncio
import requests
import aiohttp
import threading
lat = 52.52
long = 13.41
# async/await
  1. Make a fork of the project to review, and from then on use that fork for the reviews
  2. Create an empty branch with 'git checkout --orphan', for example git checkout --orphan review-1-target
  3. Run git status and note that all files are staged. Remove all files by unstaging them first with git reset . and, after, cleanning them with git clean -df.
  4. On the empty branch, create an empty commit with git commit --allow-empty -m 'Empty commit'
  5. Push the empty branch to our fork, git push -u origin review-1-target
  6. Now let’s go to the branch we want to review (say master), and create a new branch from it: git checkout -b review-1.
  7. We then want to rebase from our empty/target branch. Make sure to place the empty commit as the first commit on the branch, git rebase -i review-1-target
  8. Push the branch to the fork, git push -u origin review-1
use std::io::{self, BufRead};
use std::process::exit;
const PLAYER_SYMBOL: [&str; 2] = ["X", "O"];
// TODO use enum instead of string representation
// TODO maybe use Display for printing proper values
fn main() {
let mut board: [[&str; 3]; 3] = [[" ", " ", " "], [" ", " ", " "], [" ", " ", " "]];
let mut current_player: usize = 0;
@wjurkowlaniec
wjurkowlaniec / tictactoe.rs
Created January 1, 2023 18:20
first blood with Rust
use std::io::{self, BufRead};
use std::process::exit;
const PLAYER_SYMBOL: [&str; 2] = ["X", "O"];
fn main() {
let mut board: [[&str; 3]; 3] = [[" ", " ", " "], [" ", " ", " "], [" ", " ", " "]];
let mut current_player: usize = 0;
let mut moves_count: u8 = 0;