Skip to content

Instantly share code, notes, and snippets.

View andreybutov's full-sized avatar

Andrey Butov andreybutov

View GitHub Profile
@andreybutov
andreybutov / cpdir
Last active June 25, 2020 11:46
Command line alias to copy the current working directory (pwd) to the OS X clipboard.
# .bashrc / .bash_profile
# copy pwd to the clipboard
alias cpdir="pwd | tr -d '\n' | pbcopy"
@andreybutov
andreybutov / bordered_edit_field.java
Created August 11, 2018 13:32
A custom bordered edit field for BlackBerry apps.
//
// Andrey Butov ( andreybutov.com )
//
import net.rim.device.api.ui.component.EditField;
import net.rim.device.api.ui.Graphics;
class BorderedEditField extends EditField {
BorderedEditField() {
@andreybutov
andreybutov / is_valid_bb_pin.pl
Created August 11, 2018 13:28
Validating BlackBerry PIN codes in Perl
#
# Validating a BlackBerry PIN in Perl.
#
# Andrey Butov ( andreybutov.com )
#
my $pin = <get PIN from submitted web page data>
return “Error” if !defined($pin);
$pin = &trimAndUpper($pin);
@andreybutov
andreybutov / Debug.java
Created August 10, 2018 21:59
Debugging BlackBerry Applications: A Simple Debug Console Class
/**
Debugging a BlackBerry application can be done on a simulator,
when the bug permits that sort of thing, or on the device itself.
If you’re in a situation where you must debug your code while it
runs on a real device, your can sometimes take advantage of the
tethering debugger provided by the JDE; connecting the device to
the PC via a USB cable, and then hoping everything is stable
enough for you to catch a breakpoint and find your bug.
@andreybutov
andreybutov / bb_listening_for_address_book_changes.java
Last active August 11, 2018 12:47
Listening to address book changes in your BlackBerry app.
//
// Your BlackBerry application needs to know when the user adds,
// removes, or changes something in the BlackBerry address book.
// So, how would you go about implementing this?
//
// Here is a simple class that will listen to changes in the BlackBerry address book:
//
// - Andrey Butov (andreybutov.com)
//
@andreybutov
andreybutov / qt_start_automatically.cpp
Last active February 17, 2023 04:57
How do I make my Qt app start automatically at login?
//
// How do I make my Qt app start automatically at login?
// This solution is for Windows and Mac. It was tested with Qt 5.5.
//
// - Andrey Butov ( andreybutov.com )
//
void setAppToStartAutomatically ( bool startAutomatically )
{
#if defined ( Q_OS_MAC )