Tags » Code Snippet

C / C++ - Fast add nanoseconds to timespec structure

C나 C++ 프로그램에서 나노세컨트 단위의 시간을 처리해야 하는 경우가 간혹 있는데 이 경우에는 timespec 구조체를 사용하는 것이 적당하다.

만약 timespec을 사용하다가 특정 시점에서 몇 나노 세컨드 이후의 timespec이 필요한 경우에는 아래의 Snippet을 활용하면 된다. 140 more words


A Horrible Abuse of Gradients in the Name of Fancy Buttons

Here’s a demo of a button style I’ve been playing with lately.

I could perhaps be done in an easier way, but I’m using four CSS gradients in the background to simulate four bevelled corners. 25 more words

ViewModelBase code snippet in WPF

public class ViewModelBase : INotifyPropertyChanged
    public event PropertyChangedEventHandler PropertyChanged;

    protected virtual bool SetFields<T>(T value, ref T field,  string propertyName = null)
        var hasChanged = Equals(value, field);

        if (hasChanged)
        return hasChanged;

    protected virtual void Notify( string propertyName = null)
        var handler = PropertyChanged;
        if (handler != null)
            handler(this, new PropertyChangedEventArgs(propertyName));

LIST/VIEW March 4th, 2015

Here is what was discussed in class (as I remember it).

We worked in three separate documents today: our config file, demo_list, and demo_view files. Our config file added a couple new functions. 195 more words

More Beers! 03/02/2015

We continued work on the Beer Database and rehashed some of the same information.

Working in our Adminer, the information can be exported and imported into a Docs folder. 128 more words

Class for 2/23/2015

Today we populated our template site, “Grey”, with data from a sample database.

This is a powerful tool for creating the tile like Amazon format. The code that we implemented looked like this:

Vertically Align Anything

For this first week I want to give total props to Sebastian Ekström over at zerosixthree.se. He wrote an amazing blog post that has spurred me on to share this snippet even more.   275 more words

Web Development