Skip to content

Instantly share code, notes, and snippets.

View RammusXu's full-sized avatar

RammusXu RammusXu

View GitHub Profile
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();
}
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();
@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;
<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>
class BrowseController < ApplicationController
def index
path = "public/apk_pool/"+ params[:folder] +"/*"
@apks = Dir.glob(path)
@apks.each do |apk|
puts apk
end
end
def show
@RammusXu
RammusXu / base.py
Last active March 19, 2021 14:06
Python Parser
import xml.etree.ElementTree as ET
tree = ET.parse("arrays.xml")
ET.dump(tree)
tree.write("new_strins.xml")
@RammusXu
RammusXu / promise
Created April 29, 2016 07:48
how to refactor it ?
var request = [
profileUtil.createUser('[email protected]', 'qwer1234', 'test', 'Company'),
profileUtil.createUser('[email protected]', 'qwer1234', 'test2', 'Company'),
];
request[0].then(function(value) {
return request[1];
})
.then(function(value) {
return request[2];
@RammusXu
RammusXu / demo.js
Last active May 6, 2016 02:36
variable changed by other, but I just want to get a clone of it
var mo = require('./module')();
console.log(mo);
var who = mo.A;
console.log(who);
who.name ='wal2er';
console.log(who);
console.log(mo);
version: "2"
services:
overworld:
image: dstacademy/dontstarvetogether
container_name: overworld
hostname: overworld
tty: true
stdin_open: true
command: dst-server start --update=all
env_file: ./overworld.env
kind: Service
apiVersion: v1
metadata:
name: telepresence-rammus
spec:
selector:
owner: rammus
type: LoadBalancer
ports:
- name: http