Skip to content

Instantly share code, notes, and snippets.

View Yoloabdo's full-sized avatar
:octocat:
Building another UIViewController

Abdoelrhman Yoloabdo

:octocat:
Building another UIViewController
View GitHub Profile
@Yoloabdo
Yoloabdo / mysql-convert-utf8.py
Created July 26, 2012 04:29 — forked from ssbarnea/mysql-convert-utf8.py
Script to convert a a database to use utf8 encoding
#! /usr/bin/env python
import MySQLdb
host = "localhost"
passwd = ""
user = "root"
dbname = "mydbname"
db = MySQLdb.connect(host=host, user=user, passwd=passwd, db=dbname)
cursor = db.cursor()
@Yoloabdo
Yoloabdo / student struct
Last active March 14, 2017 20:25
student struct
struct student
{
int id;
string name;
string classNumber;
};
@Yoloabdo
Yoloabdo / students
Created December 25, 2014 23:01
string array
string students[30] = {"ahmed", "ali", "mostafa", .... };
@Yoloabdo
Yoloabdo / students
Created December 25, 2014 23:06
string array
string months[] = { "Jan", "Feb", "Mar", "April", "May", "June", "July", "Aug", "Sep", "Oct", "Nov", "Dec" };
@Yoloabdo
Yoloabdo / students
Created December 25, 2014 23:07
string array
string fifth = months[5];
@Yoloabdo
Yoloabdo / students
Created December 25, 2014 23:23
string array
for (int i = 0; i < 30; ++i) {
cout << students[i] << endl;
}
for (int i = 0; i < 5; ++i) {
cout << months[i] << endl;
}
@Yoloabdo
Yoloabdo / NSTimer
Created July 18, 2015 18:27
Creating a NSTimer to refresh the play bar every second
var timer = NSTimer.scheduledTimerWithTimeInterval(0.1, target:self, selector: Selector("updateSlider"), userInfo: nil, repeats: true)
@Yoloabdo
Yoloabdo / NSTimer
Created July 18, 2015 18:34
The update bar(slider) function
// in the mainView class we need to create an outlet for the slider, and the text label for the current time.
@IBOutlet weak var audioPlayerBar: UISlider!
@IBOutlet weak var timeViewer: UILabel!
// updating slider function
func updateSlider(){
let currentTime = Float(nsTimerToSeconds(audioPlayer.currentTime))
audioPlayerBar.value = currentTime
timeViewer.text = "\(currentTime) / \(audioLengthSeconds)"
}
@Yoloabdo
Yoloabdo / NSTimer
Created July 18, 2015 18:45
Slider time change function
@IBAction func SliderChange(sender: UISlider) {
audioPlayer.stop()
var newTime = audioPlayerBar.value
audioPlayer.currentTime = NSTimeInterval(newTime)
audioPlayer.play()
}
//
// PlaySoundViewControlerViewController.swift
// Record Teen
//
// Created by abdelrahman mohamed on 7/16/15.
// Copyright (c) 2015 abdelrahman mohamed. All rights reserved.
//
import UIKit
import AVFoundation