Skip to content

Instantly share code, notes, and snippets.

@hitapia
hitapia / scripts.sh
Last active December 27, 2015 13:03
Install PHP7, apache2 and mysql
## Install PHP 7
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php-7.0
sudo apt-get update
sudo apt-get install -y php7.0
## Install Apache2
sudo add-apt-repository ppa:ondrej/apache2
sudo apt-get update
sudo apt-get install apache2
@hitapia
hitapia / gist:b57ecf1d02786a90ca46
Created December 22, 2015 10:47
make swap file - UBUNTU
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon -s
@hitapia
hitapia / gist:6cfcc16b73c155fefa61
Created December 22, 2015 10:46
php7 install - UBUNTU
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php-7.0
sudo apt-get update
sudo apt-get install -y php7.0
@hitapia
hitapia / delitemsinarraylist.java
Created December 22, 2015 06:49
Delete items in ArrayList - Android
private ArrayList<Keyword> items = new ArrayList<Keyword>();
private void DelItems(ArrayList<String> delid){
Iterator<Keyword> iter = items.iterator();
while (iter.hasNext()) {
if (delid.contains(((Keyword)iter.next()).id)) {
iter.remove();
}
}
}
@hitapia
hitapia / gist:6552500f08e5c2a005cf
Created December 20, 2015 11:48
Use SharedPreferences - Android
private void logout(){
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
Editor editor = pref.edit();
editor.clear();
editor.commit();
}
private void storeSomthing(){
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
Editor editor = pref.edit();
@hitapia
hitapia / Confirm.java
Created December 20, 2015 03:33
Confirm Alert - Android
private void someConfirm(){
new AlertDialog.Builder(new ContextThemeWrapper(getContext(), android.R.style.Theme_Material_Dialog_Alert))
.setMessage("정말로?")
.setNegativeButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
//TODO~
}
})
.setPositiveButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
@hitapia
hitapia / gist:f4161493d770a78cd3b9
Last active December 18, 2015 04:34
Android - Image Crop...
//선택된 이미지를 크롭
private void makeCrop(Uri picUri){
Intent pickImageIntent = new Intent("com.android.camera.action.CROP");
pickImageIntent.setDataAndType(picUri, "image/*");
pickImageIntent.putExtra("crop", "true");
pickImageIntent.putExtra("outputX", 200);
pickImageIntent.putExtra("outputY", 200);
pickImageIntent.putExtra("aspectX", 1);
pickImageIntent.putExtra("aspectY", 1);
pickImageIntent.putExtra("scale", true);