Skip to content

Instantly share code, notes, and snippets.

View MadinaB's full-sized avatar
we all shine in different ways

Madina MadinaB

we all shine in different ways
View GitHub Profile
@MadinaB
MadinaB / ConcurrentModificationException
Created January 6, 2019 17:59
ConcurrentModificationException
import java.util.*;
public class MyClass {
public static void main(String args[]) {
LinkedList<Integer> list = new LinkedList<>();
list.addFirst(1);
Iterator key = list.listIterator(0);
list.add(1);
System.out.println(key.next());
}
sudo apt-get update && sudo apt-get dist-upgrade
.gitignore file
To see the file in folder make 'ls a', to modify do 'vi .gitignore file'. Use this file to insert there full pathes and names of folders/files/objects you would not want to commit to the repo.
git init
To create a new, empty repository in the current directory
git status
Shows status of current repo
git log
@MadinaB
MadinaB / gist:1b71082babea80cad96bcfde66dc18b5
Created May 5, 2018 17:30
Getting height of a view in OnCreate()
final View view=//smth;
...
view.post(new Runnable() {
@Override
public void run() {
view.getHeight(); //height is ready
}
});
@MadinaB
MadinaB / DrawingGist
Last active May 5, 2018 12:58
Tips on Drawing on Android
xx
@MadinaB
MadinaB / gist:d90532c0b1a193995a805a472a9f24e8
Created April 29, 2018 19:01
StepCounter for Android KitKat
MainActivity.java
package com.madinabektayeva.stepcounter;
import android.content.Context;
import android.hardware.*;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;
background.js :
if (!localStorage.isInitialized) {
localStorage.isInitialized = true;
localStorage.setItem('LatestDate', '');
localStorage.setItem('currentWebsites', '{}');
localStorage.setItem('backup','');
}
console.log('hi');
Question:
I have to delete 2 last commits pushed to original repo, one of which is a merge commit. I want to delete changes in repo and keep them on my computer.
When I do
git revert -m 1 075cc2f
It adds a revert commit to my history of commits and my 075cc2f commit is still present there.
When I do
git push origin +HEAD^:master
commit is fully deleted from history.
max_element(iter1, iter2)
min_element(iter1, iter2)
random_shuffle(iter1, iter2)
sort(iter1, iter2)