Skip to content

Instantly share code, notes, and snippets.

View lamprosg's full-sized avatar

Lampros Giampouras lamprosg

  • Athens, Greece
View GitHub Profile
@lamprosg
lamprosg / main.cpp
Created January 22, 2013 10:41
Qt - UDP sockets
#include "myudp.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
MyUDP server;
MyUDP server;
server.SayHello();
@lamprosg
lamprosg / main.cpp
Created January 23, 2013 11:54
Qt - Simple Timer
#include "mytimer.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
Mytimer mtimer; //Costructor will fire where the code is. That's it
return a.exec();
}
@lamprosg
lamprosg / main.cpp
Created January 23, 2013 12:10
Qt - qFind algorithm
//How to use qFind()
#include "mytimer.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QList<int> List;
List << 1 << 5 << 15 << 23;
@lamprosg
lamprosg / dialog.cpp
Created January 25, 2013 11:45
Qt - QCompleter (auto completions)
#include "dialog.h"
#include "ui_dialog.h"
Dialog::Dialog (QWidget *parent):
QDialog(parent),
ui(new UI::Dialog)
{
ui->setupUI(this);
/***Set the autocompletion*****/
@lamprosg
lamprosg / .pro file
Created January 25, 2013 13:41
Qt - Network (http request)
QT += network
@lamprosg
lamprosg / 1.READ ME
Last active December 12, 2015 00:18
Twitter OAuth API with PHP
1. Register a new app at dev.twitter.com/apps/
2. Fill in the fields for your site accordingly, just be sure to select Browser in Application Type, and set
the Callback URL to something like http://blahblah.com/twitter_login.php (http://localhost/ won’t be accepted because it doesn’t have a domain name).
2. Select Read & Write. Fill in the captcha, click “Register Application,” and accept the Terms of Service.
3. You get a Consumer key and Consumer secret
4. Since we’re using Twitter to authenticate users, we’ll need a database table to store those users
@lamprosg
lamprosg / quicksort.cpp
Last active August 17, 2022 17:24
Quicksort algorithm
void quickSort(int arr[], int left, int right) {
int i = left, j = right;
int tmp;
int pivot = arr[(left + right) / 2];
/* partition */
while (i <= j) {
while (arr[i] < pivot)
i++;
while (arr[j] > pivot)
@lamprosg
lamprosg / Links
Last active December 13, 2015 16:59
Objective C - iOS tutorial
@lamprosg
lamprosg / MultiAppDelegate.mm
Last active December 14, 2015 02:18
(iOS) Initializing View Controllers. Delegate file - Single & Multi View examples
//Import your root controller to the .h
//And set your property of your controller
//@property (strong, nonatomic) BIDViewController *switchViewController;
@implementation BIDAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//Create the main window screen
@lamprosg
lamprosg / BIDVIewController.mm
Last active December 14, 2015 02:19
(iOS) Going from Portrait to Landscape and back
//When the iPhone changes rotation, this method is triggered.
//Once you have 2 nibs on your controller with connected outlet collections (if necessary)
//and actions of both portrait and landscape nibs to the same method
//.
//You need to create to seperate outlets of both VIEWS in the viewcontroler .h file.
//@property (strong, nonatomic) IBOutlet UIView *portrait;
//@property (strong, nonatomic) IBOutlet UIView *landscape;
#define degreesToRadians(x) (M_PI * (x) / 180.0)