Skip to content

Instantly share code, notes, and snippets.

View RammusXu's full-sized avatar

RammusXu RammusXu

View GitHub Profile
<h1 class="text-center">新增討論版</h1>
<div class="col-md-4 col-md-offset-4">
<hr>
<%= simple_form_for @group do |f| %>
<div class="form-group">
<%= f.input :title, input_html: {class: "form_controll"} %>
<%= f.input :description, input_html: {class: "form_controll"} %>
</div>
@RammusXu
RammusXu / AlertDialogManager
Created November 11, 2014 21:09
showEnterNameDialog
package com.example.myfunction;
import android.app.AlertDialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
public void writeFile(String dir, String filename, String string) {
FileWriter fw;
try {
File f = new File(dir, filename);
if (!f.exists()) {
f.createNewFile();
}
fw = new FileWriter(f, true);
fw.append(string);
fw.close();
private void writeObject(File file, Object object) {
try {
FileOutputStream fos = new FileOutputStream(file);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(object);
oos.close();
} catch (Exception e) {
e.printStackTrace();
}