Skip to content

Instantly share code, notes, and snippets.

Pawel Niewiadomski pawelniewie

Block or report user

Report or block pawelniewie

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
pawelniewie / valid_pesel.rb
Created Mar 13, 2017
Simple PESEL validator
View valid_pesel.rb
def valid_pesel?(pesel)
false if pesel.size != 11
(a, b, c, d, e, f, g, h, i, j, k) =
checksum = a + 3*b + 7*c + 9*d + e + 3*f + 7*g + 9*h + i + 3*j + k
checksum % 10 == 0
no = gets.to_i
pawelniewie / app-assets-javascripts-application.js
Created Feb 5, 2017
Header/param based sessions for iframes
View app-assets-javascripts-application.js
//= require_self
//= require service_buttons
//= require error_reporting
$(function () {
var token = $('meta[name=token]').attr('content');
AJS.$.ajaxPrefilter(function(options) {
if (token) {
options.url += ~options.url.indexOf('?') ? '&' : '?';
View parse_day_one_json.rb
#!/bin/env ruby
require 'json'
require 'time'
cutoff = Time.parse('2016-08-10')
log = JSON.load(ARGF)
entries_per_day ={ |hash, key| hash[key] = [] }
pawelniewie / address-book.swift
Last active Jun 8, 2016
Getting rid of all first.last@domain contacts from your address book and replacing them with proper entries (or merging if that's possible). More on
View address-book.swift
#!/usr/bin/env swift
import Cocoa
import AddressBook
var ab = ABAddressBook.sharedAddressBook()
func findByFirstAndLastName(firstName: String, lastName: String) -> [ABRecord] {
let comparison: ABSearchConjunction = CFIndex(kABContainsSubStringCaseInsensitive.rawValue)
pawelniewie /
Created Apr 11, 2016
ExplicitOrdering from Guava that will not throw when element is outside of the initial collection (unknown to the explicit ordering)
* Copyright (C) 2007 The Guava Authors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
View nginx_test.go
package main
import (
# Some things taken from here
# Set the colours you can use

Keybase proof

I hereby claim:

  • I am pawelniewie on github.
  • I am pin ( on keybase.
  • I have a public key whose fingerprint is 0C9C D2EB A851 031D C1F2 C287 40DB DD41 6DBB 69BB

To claim this, I am signing this object:

View angular-datetimepicker.js
'use strict';
angular.module('$strap.directives').directive('bsDatetimepicker', [
function ($timeout, $strapConfig) {
var isAppleTouch = /(iP(a|o)d|iPhone)/g.test(navigator.userAgent);
var regexpMap = function regexpMap(language) {
language = language || 'en';
return {
'/': '[\\/]',
You can’t perform that action at this time.