Skip to content

Instantly share code, notes, and snippets.

@glebd
glebd / wavecuepoint.c
Created May 2, 2023 23:20 — forked from TimMoore/wavecuepoint.c
This code reads a .wav file and a text file containing marker locations (specified as frame indexes, one per line) and creates a new .wav file with embedded cue points for each location. The code is standard, portable C.
//
// wavecuepoint.c
// Created by Jim McGowan on 29/11/12.
// Turned into command-line utility by David Hilowitz on 19/11/16.
// jim@bleepsandpops.com
// jim@malkinware.com
//
// This function reads a .wav file and a text file containing marker locations (specified as frame indexes, one per line)
// and creates a new .wav file with embedded cue points for each location. The code is standard, portable C.
//
@glebd
glebd / C++ normal operators.md
Created May 11, 2019 00:12 — forked from beached/C++ normal operators.md
A list of the normal signatures of C++ operators that allow overloading

C++ Operator Signatures

This is a list of C++ operators that can be overloaded and their normal signatures(a.k.a what an int would do). The order is the preffered order to use them(The first one listed is often preffered)

Arithmetic

operator+ addition

  • free function -> T operator+( T const & lhs, T const & rhs )
  • member function -> T operator+( T const & rhs ) const

operator+ unary plus

  • member function -> T operator+( ) const
@glebd
glebd / Program.fs
Created January 24, 2016 04:28
Solution to Module 2 Problem of Microsoft F# Course on edX
open System
[<EntryPoint>]
let main argv =
printf "Enter empty name or age to quit.\n"
let mutable canContinue = true
while canContinue do
printf "Name: "
let name = Console.ReadLine()
if name = "" then canContinue <- false
@glebd
glebd / iPhotoLibLocation.m
Created February 12, 2013 02:33
Determine iPhoto library location with and without sandbox
+ (NSString *)libraryPath {
#ifdef APPSTORE
// Sandbox prevents us from accessing other apps' preferences.
// So we get a r/o access to ~/Library/Preferences/ and read the files directly.
//
// Need the following entitlement:
//
// <key>com.apple.security.temporary-exception.files.home-relative-path.read-only</key>
// <array>
// <string>/Library/Preferences/</string>
@glebd
glebd / PPMMainWindowController.m
Created January 23, 2013 22:34
Using NSSharingServicePicker in Mountain Lion
- (IBAction)displaySharePicker:(id)sender {
NSMutableArray *shareItems = [@[self.currentPicture.image] mutableCopy];
NSSharingServicePicker *sharingServicePicker = [[NSSharingServicePicker alloc] initWithItems:shareItems];
sharingServicePicker.delegate = self;
[sharingServicePicker showRelativeToRect:[sender bounds] ofView:sender preferredEdge:NSMinYEdge];
}
<igRibbon:RibbonTabItem x:Name="ModuleLauncherTab"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:igRibbon="clr-namespace:Infragistics.Windows.Ribbon;assembly=InfragisticsWPF3.Ribbon.v10.3"
Header="Launcher">
<ItemsControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:igRibbon="clr-namespace:Infragistics.Windows.Ribbon;assembly=InfragisticsWPF3.Ribbon.v10.3">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
#!/usr/bin/env python
#
# git-p4.py -- A tool for bidirectional operation between a Perforce depot and git.
#
# Author: Simon Hausmann <simon@lst.de>
# Copyright: 2007 Simon Hausmann <simon@lst.de>
# 2007 Trolltech ASA
# License: MIT <http://www.opensource.org/licenses/mit-license.php>
#
#!/usr/bin/env python
#
# git-p4.py -- A tool for bidirectional operation between a Perforce depot and git.
#
# Author: Simon Hausmann <simon@lst.de>
# Copyright: 2007 Simon Hausmann <simon@lst.de>
# 2007 Trolltech ASA
# License: MIT <http://www.opensource.org/licenses/mit-license.php>
#
using System;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Interop;
namespace Utility
{
public static class UserHelper
{
[DllImport("user32.dll")]
<Style TargetType="{x:Type ToggleButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border x:Name="innerBorder">
<!-- Use one JPEG image as the background of ToggleButton -->
<Border.Background>
<ImageBrush ImageSource="C:\Users\Public\Pictures\Sample Pictures\Tree.jpg" />
</Border.Background>
</Border>