Skip to content

Instantly share code, notes, and snippets.

Avatar
we all shine in different ways

Madina MadinaB

we all shine in different ways
View GitHub Profile
@MadinaB
MadinaB / ConcurrentModificationException
Created Jan 6, 2019
ConcurrentModificationException
View 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());
}
View git-commands
.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
Getting height of a view in OnCreate()
View gist:1b71082babea80cad96bcfde66dc18b5
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
Tips on Drawing on Android
View gist:d90532c0b1a193995a805a472a9f24e8
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;
View #1
background.js :
if (!localStorage.isInitialized) {
localStorage.isInitialized = true;
localStorage.setItem('LatestDate', '');
localStorage.setItem('currentWebsites', '{}');
localStorage.setItem('backup','');
}
console.log('hi');
View Deleting pushed merge and commit from original repository and commit history on GitHub
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.
View STL algotirhtms
max_element(iter1, iter2)
min_element(iter1, iter2)
random_shuffle(iter1, iter2)
sort(iter1, iter2)