Skip to content

Instantly share code, notes, and snippets.

@M-Medhat
M-Medhat / RegExReplace.swift
Created February 2, 2015 09:33
Regular Expressions: How to replace patterns in Swift
// You need to import Foundation to use NSRegularExpression, NSError and NSString
import Foundation
/// This function takes three parameters
/// text: a string that we search in
/// pattern: a reqular expression pattern to use in the search
/// withTemplate: the string that we use instead of the occurrances we find in text
///
/// The method returns (text) with occurrance found using (pattern) replaced with (withTemplate)
func regexReplace(text:String, pattern:String, withTemplate:String) -> String {
@bharath2020
bharath2020 / Download 'data' from Android without roooting
Last active January 25, 2024 21:13
Download manifest from Android APK
//download data.ab (encrypted) and DONOT GIVE ANY PASSWORD when prompted
adb backup -f ~/data.ab -noapk app.package.name
//decrypt and extract the data.ab [this worked most of the time except for few instances ]
//this will output all the contents of app into 'apps' directory
dd if=data.ab bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" | tar -xvf -
//SOURCE: http://blog.shvetsov.com/2013/02/access-android-app-data-without-root.html
@keyboardsurfer
keyboardsurfer / studio64.vmoptions
Created January 26, 2015 10:02
My vmoptions for android studio
-Xms1G
-Xmx8G
-XX:MaxPermSize=4G
-XX:ReservedCodeCacheSize=512m
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-Djna.nosys=true
-Djna.boot.library.path=
@arturlector
arturlector / ios-questions-interview.md
Last active February 25, 2024 18:44
Вопросы на собеседование iOS разработчика.

Вопросы на собеседование iOS разработчика (дополненное издание):

General:

  • Что такое полиморфизм?

  • Что такое *инкапсуляция? Что такое *нарушение инкапсуляции?

  • Чем абстрактный класс отличается от интерфейса?

  • Расскажите о паттерне MVC. Чем отличается пассивная модель от активной?

@polbins
polbins / README.md
Last active February 29, 2024 09:58
Simple RecyclerView Divider

Simple RecyclerView Divider

Simple Horizontal Divider Item Decoration for RecyclerView

    mRecyclerView.addItemDecoration(new SimpleDividerItemDecoration(
            getApplicationContext()
    	));

NOTE: Add item decoration prior to setting the adapter

@lapastillaroja
lapastillaroja / DividerItemDecoration.java
Last active November 17, 2023 23:06 — forked from akmalxxx/DividerItemDecoration.java
DividerItemDecoration. RecyclerView.ItemDecoration simple implementation
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
@derme302
derme302 / GoogleMap.cs
Last active January 31, 2024 07:38
Load a Google Map into Unity3D
/*
* Based on the Google Maps for Unity Asset
* https://www.assetstore.unity3d.com/en/#!/content/3573
* However the relience on UniWeb has been removed
*
*
Getting Started
---------------
1. Assign the GoogleMap component to your game object.
anonymous
anonymous / TestDb.java
Created August 21, 2014 07:40
// Use this in your testLocationTable() method
// Test data we're going to insert into the DB to see if it works.
String testLocationSetting = "99705";
String testCityName = "North Pole";
double testLatitude = 64.7488;
double testLongitude = -147.353;
@cyrilmottier
cyrilmottier / _app_avelibRelease_res_values_config.xml
Last active November 20, 2020 11:27
Using the new Gradle-based Android build system: an example
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="config_app_name">AVélib</string>
<string name="config_authority">com.cyrilmottier.android.avelib.citybikes</string>
<string name="config_com.google.android.maps.v2.api_key">XXX</string>
</resources>
@dodyg
dodyg / gist:5823184
Last active March 29, 2024 03:59
Kotlin Programming Language Cheat Sheet Part 1

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.