Skip to content

Instantly share code, notes, and snippets.

View deda9's full-sized avatar
๐Ÿ
Learning is always fun

Bassem Qoulta deda9

๐Ÿ
Learning is always fun
View GitHub Profile
@deda9
deda9 / factory.java
Created July 11, 2016 15:46 — forked from rishi93/factory.java
Design Patterns - Factory Pattern
import java.io.*;
interface Shape
{
public void draw();
}
class Square implements Shape
{
@Override
@deda9
deda9 / Android God Cheat Sheet
Last active July 11, 2016 22:49
It contain some fixed Code we all write in every application
Button Background Selector insdide drawble folder ----------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/numpad_button_bg_selected" android:state_selected="true"></item>
<item android:drawable="@drawable/numpad_button_bg_pressed" android:state_pressed="true"></item>
<item android:drawable="@drawable/numpad_button_bg_normal"></item>
</selector>
@deda9
deda9 / AppHelper.java
Created October 8, 2016 21:12 — forked from anggadarkprince/AppHelper.java
Upload file with Multipart Request Volley Android
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import java.io.ByteArrayOutputStream;
/**
* Sketch Project Studio
* Created by Angga on 12/04/2016 14.27.
*/
public class AppHelper {
@deda9
deda9 / GooglePlusLogin.Java
Last active April 25, 2017 15:24
How to Integrate Google Plus Login with android.
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.support.v4.app.FragmentActivity;
import com.apptcom.external.logging.Logger;
import com.apptcom.external.model.UserSocialModel;
import com.google.android.gms.auth.api.Auth;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;

SHORTCUTS

Key/Command Description
Tab Auto-complete files and folder names
Ctrl + A Go to the beginning of the line you are currently typing on
Ctrl + E Go to the end of the line you are currently typing on
Ctrl + U Clear the line before the cursor
Ctrl + K Clear the line after the cursor
Ctrl + W Delete the word before the cursor
Ctrl + T Swap the last two characters before the cursor
@deda9
deda9 / OperationBlock.swift
Last active June 7, 2018 20:15
Create OperationBlock
let operation = BlockOperation.init()
let operationBlock = {
print("I am operation Block")
}
operation.addExecutionBlock {
operationBlock()
}
operation.start()
@deda9
deda9 / MoreOperationBlock.swift
Created June 7, 2018 20:22
How to inject new block to created Operation
let operation = BlockOperation.init()
let operationBlock1 = {
print("I am operation Block One")
}
let operationBlock2 = {
print("I am operation Block Two")
}
operation.addExecutionBlock {
@deda9
deda9 / CustomOperationBlock.swift
Created June 7, 2018 20:41
How to create Custom operation block
class CustomOperationBlock: Operation{
private var data: Any!
init(_ data: Any){
self.data = data
}
override func main() {
doWork()
@deda9
deda9 / ConcurrencyCustomOperationBlock.swift
Created June 7, 2018 22:38
How to create Concurrency custom operation block
enum OperationState: Int {
case ready
case executing
case finished
}
class CustomOperationBlock: Operation{
private var state: OperationState!
@deda9
deda9 / DependencyNSOperationBlock.swift
Created June 7, 2018 22:50
How to create Dependencies for NSOperationBlock in swift
let operationQueue = OperationQueue()
let op0 = BlockOperation()
op0.completionBlock = {
print("op0 completionBlock")
}
op0.addExecutionBlock {
print("op0 executionBlock #1")
}