Skip to content

Instantly share code, notes, and snippets.

View be9's full-sized avatar

Oleg Dashevskii be9

View GitHub Profile
@be9
be9 / -
Created February 20, 2014 12:55
ExifTool Version Number : 9.47
File Name : IMG_0021.JPG
Directory : /Volumes/RedStore/Tanya/fotos/14_02_20_start_d20
File Size : 2.5 MB
File Modification Date/Time : 2014:02:20 17:23:02+07:00
File Access Date/Time : 2014:02:20 17:23:02+07:00
File Inode Change Date/Time : 2014:02:20 17:23:02+07:00
File Permissions : rwxr--r--
File Type : JPEG
MIME Type : image/jpeg
#include <vector>
#include <iostream>
using namespace std;
template <typename T>
class Initializer {
public:
Initializer(T &_array)
: array(_array) {}
  1. Стандартные контейнеры C++.
  2. Алгоритмы в стандартной библиотеке C++ (#include ).
  3. Конструктор копирования. Перегрузка оператора присваивания. Ключевое слово explicit.
  4. Перегрузка операторов в C++.
  5. Принцип RAII. Умные указатели в C++. Мотивация и реализация.
  6. Паттерн Singleton («одиночка»). Варианты его реализации в C++.
  7. Принцип COW.
  8. RTTI в C++.
  9. Паттерны Singleton, Prototype и Builder.
  10. Паттерны Abstract Factory и Factory Method.
@be9
be9 / circle.c
Created September 10, 2014 06:58
#include <stdio.h>
#include "circle.h"
#include "new.h"
static void *Circle_ctor(void *_self, va_list *app) {
struct Circle *self = ((const struct Class *)Point)->ctor(_self, app);
self->rad = va_arg(*app, int);
return self;
}
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" creator="GPS TrackMaker" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
<metadata>
<link href="http://www.gpslib.ru">
<text>GPSLib tracks collection</text>
</link>
<time>2014-11-24T10:29:38+03:00Z</time>
<bounds minlat="45.011369" minlon="41.946345" maxlat="45.015844" maxlon="41.954083" />
</metadata>
<trk>
@be9
be9 / Gemfile
Last active August 29, 2015 14:13
source 'https://rubygems.org'
gem 'activerecord', '4.2.0'
gem 'sqlite3'
gem 'bcrypt', '~> 3.1.7'
/**
* Copyright (c) 2013, Simone Pellegrini All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright notice,
@be9
be9 / bright.rb
Created April 30, 2015 04:25
Brightness function
def bright?(color)
if color =~ /^#([[:xdigit:]]{2})([[:xdigit:]]{2})([[:xdigit:]]{2})$/
r = $1.to_i(16)
g = $2.to_i(16)
b = $3.to_i(16)
# Use formula to calculate brightness
# http://www.nbdtech.com/Blog/archive/2008/04/27/Calculating-the-Perceived-Brightness-of-a-Color.aspx
brightness = Math.sqrt(r*r*0.241+g*g*0.691+b*b*0.068) / 255 * 100.0
@be9
be9 / gist:10747
Created September 14, 2008 18:51
#!/usr/bin/env ruby
require 'rubygems'
require 'dm-core'
require 'dm-is-list'
require 'pp'
class Participation
include DataMapper::Resource
property :id, Serial