Skip to content

Instantly share code, notes, and snippets.

View ciembor's full-sized avatar

Maciej Ciemborowicz ciembor

View GitHub Profile
@ciembor
ciembor / gist:1494530
Created December 18, 2011 21:28
RGB to HSL and HSL to RGB conversion functions
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))
typedef struct rgb {
float r, g, b;
} RGB;
typedef struct hsl {
float h, s, l;
} HSL;
irb(main):053:0> AlcoholLicense.where('reported_at > ? AND license_category_id=1 AND business_category_id=2', Time.now - 26.months).where(location_id: Location.kazimierz.ids).map{|a| {nazwa: a.busin
ess.name, ulica: a.location.address_1, numer: a.location.address_2}}
[
{
"nazwa": "POPLAWSKA DOROTA",
"ulica": "AUGUSTIAŃSKA",
"numer": "4"
},
{
@ciembor
ciembor / antykwa_poltawskiego.json
Created December 12, 2019 11:47
Report from fontbakery check-googlefonts of Antykwa Półtawskiego font quality.
This file has been truncated, but you can view the full file.
{
"result": {
"FAIL": 466,
"INFO": 218,
"PASS": 1644,
"SKIP": 2658,
"WARN": 323
},
"sections": [
{
@ciembor
ciembor / bn.c
Created December 19, 2011 14:45
Brightness normalization
/*
* author: Maciej Ciemborowicz
* Jagiellonian University
* ZGK 2011/2012
*
* gcc gd_wewy.o bn.c -o bn -lgd -ansi -Wall -pedantic
*/
#include <stdio.h>
#include <math.h>
@ciembor
ciembor / usb_urb.md
Created May 28, 2019 22:47
SoundLab usb urb

URB_INTERRUPT out

Frame 692: 35 bytes on wire (280 bits), 35 bytes captured (280 bits) on interface 0
    Interface id: 0 (\\.\pipe\wireshark_extcap_\\.\USBPcap1_20190528224209)
    Encapsulation type: USB packets with USBPcap header (152)
    Arrival Time: May 28, 2019 22:42:48.857235000 Środkowoeuropejski czas letni
    [Time shift for this packet: 0.000000000 seconds]
    Epoch Time: 1559076168.857235000 seconds
    [Time delta from previous captured frame: 0.045329000 seconds]
    [Time delta from previous displayed frame: 0.000000000 seconds]
require "pundit/version"
require "active_support/concern"
require "active_support/core_ext/string/inflections"
require "active_support/core_ext/object/blank"
require "active_support/core_ext/module/introspection"
require "active_support/dependencies/autoload"
module Pundit
  class PolicyFinder
    attr_reader :object
@ciembor
ciembor / qunit.css
Created March 10, 2012 22:45
Customized QUnit CSS style. Dark, with Monokai colors.
/**
* QUnit v1.4.0pre - A JavaScript Unit Testing Framework
*
* http://docs.jquery.com/QUnit
*
* Copyright (c) 2012 John Resig, Jörn Zaefferer
* Dual licensed under the MIT (MIT-LICENSE.txt)
* or GPL (GPL-LICENSE.txt) licenses.
*/
module MyModule
@converter = Converter.new(:json)
class << self
def format=(format)
@converter.format = format
end
end
end
// config.js
var watcher = new TimeWatcher();
var refresh = new RefreshAction();
watcher.onPeriod(5, refresh);
// auster.js
var FsWatcher = require('./watchers/FsWatcher.js');
@ciembor
ciembor / gist:4751901
Created February 11, 2013 01:40
Callback hell.
function refresh() {
chrome.windows.getAll(function(windows) {
for (var i = 0; i < windows.length; i++) {
chrome.tabs.getAllInWindow(windows[i].id, function(tabs) {
chrome.storage.sync.get('active', function(object) {
if (object.active !== undefined) {
for (var j = 0; j < tabs.length; j++) {
if (-1 !== object.active.indexOf(tabs[j].url)) {
chrome.tabs.reload(tabs[j].id);
}