Skip to content

Instantly share code, notes, and snippets.

View mertsimsek's full-sized avatar
:shipit:
hey!

Mert Simsek mertsimsek

:shipit:
hey!
View GitHub Profile
@mertsimsek
mertsimsek / .bashrc
Created October 1, 2018 06:52
An alias that saves your vaulable files from you
alias rm="promptUser"
promptUser () {
isWithOptions=0
fileName=""
if [[ "$1" == -* ]]; then
isWithOptions=1
fileName=$2
else
@mertsimsek
mertsimsek / xcode-build-bump.sh
Created June 29, 2016 07:15 — forked from sekati/xcode-build-bump.sh
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@mertsimsek
mertsimsek / besiege.sh
Last active August 29, 2015 14:17
Besiege Auto Readme Generator
git pull origin master
rm README.md
touch README.md
echo "# PREVIEWS OF VEHICLES" >> README.md
echo "## In the list below, you can see previews of vehicles that seen here." >> README.md
echo "---" >> README.md
for ext in png; do
files=( "Thumbnails/"*."$ext" )
@mertsimsek
mertsimsek / DynamicTextSize.m
Last active August 29, 2015 14:17
Dynamic text size for iOS
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 20)];
/*
set your label's font to the suitable one of the below to make your text size dynamic.
*/
label.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
label.font = [UIFont preferredFontForTextStyle:UIFontTextStyleCaption1];
  • Create new repository

git init

  • Configure git settings

git config –global user.name “GDG Ankara”

  • Add changes to Index

git add .

  • Commit changes
@mertsimsek
mertsimsek / read_write_file.c
Created March 16, 2013 12:42
Read and Write on File in C
void readInput(char* inputFile) {
FILE *fp;
fp = fopen(inputFile, "r");
int x;
while ((x = fgetc(fp)) != EOF) {
printf("%c", x);
}
fclose(fp);
}
@mertsimsek
mertsimsek / Serialization.java
Last active December 15, 2015 00:58
Code snippet about saving and loading on JAVA by using serialization. In this one, i prefer to save/load an arraylist. You can customize it.
public static void savingArrayList(File saveFile , ArrayList<MyClass> myArrayList ){
try {
FileOutputStream fos = new FileOutputStream(saveFile);
GZIPOutputStream gzos = new GZIPOutputStream(fos);
ObjectOutputStream out = new ObjectOutputStream(gzos);
out.writeObject(myArrayList);
out.flush();
out.close();
}catch (IOException e) {
System.out.println(e);
@mertsimsek
mertsimsek / InternetAvail.java
Last active December 15, 2015 00:58
Looks for internet availability on Android.
public class InternetAvailability{
public boolean isInternetAvailable(){
try {
ConnectivityManager nInfo = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
nInfo.getActiveNetworkInfo().isConnectedOrConnecting();
Log.i(TAG, "Net avail:"
+ nInfo.getActiveNetworkInfo().isConnectedOrConnecting());
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo();