Skip to content

Instantly share code, notes, and snippets.

İbrahim Süren ibrahimsn98

Block or report user

Report or block ibrahimsn98

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ibrahimsn98
ibrahimsn98 / sudoku.c
Created Dec 8, 2018
C Sudoku Solver Backtracing
View sudoku.c
#include <stdio.h>
int sudo[9][9];
int isExistsInRow(int row, int s) {
int i;
for(i=0; i<9; i++)
if(sudo[row][i] == s)
return 1;
@ibrahimsn98
ibrahimsn98 / SeekBarPreference.kt
Created Oct 27, 2018
Android Custom SeekBar Preference
View SeekBarPreference.kt
class SeekBarPreference(context: Context, attrs: AttributeSet) :
Preference(context, attrs, 0) {
private var max = 0
private var current = 0
init {
widgetLayoutResource = R.layout.preference_seekbar
layoutResource = R.layout.preference_seekbar
@ibrahimsn98
ibrahimsn98 / gist:e5b2261aa53964183c561437c02f8740
Last active Aug 24, 2018
Extract all zip files to the same folder
View gist:e5b2261aa53964183c561437c02f8740
find . -name "*.zip" -exec unzip {} \;
View FixAppBarLayoutBehavior.java
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@ibrahimsn98
ibrahimsn98 / ApplicationModule.java
Created Aug 19, 2018
android-mvvm-with-dagger-2
View ApplicationModule.java
@Singleton
@Module(includes = ViewModelModule.class)
public class ApplicationModule {
private static final String BASE_URL = "https://api.github.com/";
@Singleton
@Provides
static Retrofit provideRetrofit() {
return new Retrofit.Builder().baseUrl(BASE_URL)
@ibrahimsn98
ibrahimsn98 / ContextModule.java
Created Aug 19, 2018
android-mvvm-with-dagger-2
View ContextModule.java
@Module
public abstract class ContextModule {
@Binds
abstract Context provideContext(Application application);
}
View gist:8115672b83abcc4b2c3bc7422c03abe6
sudo /sbin/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 8000 -j ACCEPT
@ibrahimsn98
ibrahimsn98 / django-rest-framework.py
Created Aug 6, 2018
django-rest-framework-jwt-get-user-from-token
View django-rest-framework.py
jwt_decode_handler = api_settings.JWT_DECODE_HANDLER
jwt_get_username_from_payload = api_settings.JWT_PAYLOAD_GET_USERNAME_HANDLER
token = ''
try:
payload = jwt_decode_handler(token)
except jwt.ExpiredSignature:
return
except jwt.DecodeError:
@ibrahimsn98
ibrahimsn98 / ViewModelFactory.java
Last active Aug 19, 2018
android-mvvm-with-dagger-2
View ViewModelFactory.java
@Singleton
public class ViewModelFactory implements ViewModelProvider.Factory {
private final Map<Class<? extends ViewModel>, Provider<ViewModel>> creators;
@Inject
public ViewModelFactory(Map<Class<? extends ViewModel>, Provider<ViewModel>> creators) {
this.creators = creators;
}
@ibrahimsn98
ibrahimsn98 / ListFragment.java
Last active Aug 19, 2018
android-mvvm-with-dagger-2
View ListFragment.java
public class ListFragment extends BaseFragment implements RepoSelectedListener {
@BindView(R.id.recyclerView) RecyclerView listView;
@BindView(R.id.tv_error) TextView errorTextView;
@BindView(R.id.loading_view) View loadingView;
@Inject ViewModelFactory viewModelFactory;
private ListViewModel viewModel;
@Override
You can’t perform that action at this time.