Skip to content

Instantly share code, notes, and snippets.

View yavuztas's full-sized avatar
🏠
Working from home

Yavuz Tas yavuztas

🏠
Working from home
View GitHub Profile
@yavuztas
yavuztas / git_workflow.txt
Last active November 13, 2018 23:09
Git commit individual files and revert workflow
#Get a list of files you want to commit
$ git status
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: file1
modified: file2
@yavuztas
yavuztas / git_clone_bare_repository.txt
Created June 8, 2017 13:44
Git cloning bare repository
git clone --mirror: to clone every references (commits, tags, branches)
git push --mirror: to push everything
That would give:
git clone --mirror https://bitbucket.org/exampleuser/repository-to-mirror.git
# Make a bare mirrored clone of the repository
cd repository-to-mirror.git
git remote set-url --push origin https://github.com/exampleuser/mirrored
# Set the push location to your mirror
@yavuztas
yavuztas / git_undo_merge.txt
Created June 13, 2017 11:27
Git undo a branch merge
With git log check which commit is one prior the merge. Then you can reset it using:
git reset --hard commit_sha
There's also another way
git reset --hard HEAD~1
will get you back 1 commit.
Be aware that any modified and uncommitted/unstashed files will be reset to their unmodified state.
To keep them either stash changes away or see --merge option below.
@yavuztas
yavuztas / index.html
Last active February 7, 2023 17:25
remove-rubber-band-web-apps-ios
<!DOCTYPE html>
<html>
<head>
<title>Remove rubberband scrolling from web apps on mobile safari and standalone (iOS)</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<style>
html, body {margin: 0; padding: 0; width:100%; height:100%; overflow: hidden; background: #333}
p.center {
@yavuztas
yavuztas / gulpfile.js
Last active January 12, 2019 19:21 — forked from klugjo/gulpfile.js
Basic gulpfile.js for serve static files for gulp version 4+
// Add our dependencies
var gulp = require('gulp'), // Main Gulp module
concat = require('gulp-concat'), // Gulp File concatenation plugin
open = require('gulp-open'), // Gulp browser opening plugin
connect = require('gulp-connect'); // Gulp Web server runner plugin
// Configuration
var configuration = {
paths: {
# only if you do not add the original repository as upstream
git remote add upstream https://github.com/original_github_username/original_github_repo_name.git
# then fetch and create a new branch for your pr
git fetch --all
git checkout -b new-branch-name-for-pr upstream/master
# pick the commits you want to include in your pr
git cherry-pick a52afa1
git cherry-pick 08f39f7
public class UtilsForCollections {
}
public class UtilsForCollections {
private UtilsForCollections() {
}
}
public static <T> List<T> toList(T[] array) {
// TODO implement but how?
}
public static <T> List<T> toList(T[] array) {
return Arrays.stream(array).collect(Collectors.toList());
}