Skip to content

Instantly share code, notes, and snippets.

View saymagic's full-sized avatar
🎯
Focusing

saymagic saymagic

🎯
Focusing
View GitHub Profile
git init
初始化本地git仓库(创建新仓库)
git config --global user.name "xxx"
配置用户名
git config --global user.email "xxx@xxx.com"
配置邮件
git clone git+ssh://git@192.168.53.168/VT.git
@saymagic
saymagic / 0_reuse_code.js
Created February 2, 2016 03:48
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@saymagic
saymagic / README.md
Created February 22, 2016 05:18 — forked from lopspower/README.md
Testing activity in Android Studio

Testing activity in Android Studio

How we build the app

Before we start writing our first UI test I want to describe our development process.

  1. First, we write a test for a UI or logic that does not yet exist.
  2. We expect to see build errors or failed tests.
  3. Then we create a UI element or write program logic.
  4. Finally, we run the test and make sure it passes.
@saymagic
saymagic / README.md
Created February 22, 2016 05:18 — forked from lopspower/README.md
How to Analyze & Manage Memory on Android Like a Boss

Analyze & Manage Memory on Android Like a Boss

This Blog is all about memory management in Android. It provides information about how you can analyze & reduce memory usage while developing an Android app.

Memory management is a complex field of computer science and there are many techniques being developed to make it more efficient. This guide is designed to introduce you to some of the basic memory management issues that programmers face.

Memory Management in Android

Android is a Linux based operating system. It uses native open source C libraries which power Linux machines. All the basic operating system operations like I/O, memory management and so on are handled by the Linux kernel. Like Java and .NET, Android uses its own run time and virtual machine to manage application memory. Unlike either of these frameworks, the Android run time also manages the lifetime processes. Each Android application runs in a separate process within its own Dalvik instance, relinquishing all responsibility for memo

@saymagic
saymagic / README.md
Created February 22, 2016 05:19 — forked from lopspower/README.md
Material Animations

Material Animations

Android Arsenal

[Android Transition Framework][transition-framework] can be used for three main things:

  1. Animate activity layout content when transitioning from one activity to another.
  2. Animate shared elements (Hero views) in transitions between activities.
  3. Animate view changes within same activity.
@saymagic
saymagic / API.md
Created July 14, 2016 10:06 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@saymagic
saymagic / ItemClickSupport.java
Created September 2, 2016 18:57 — forked from nesquena/ItemClickSupport.java
Click handling for RecyclerView
/*
Source: http://www.littlerobots.nl/blog/Handle-Android-RecyclerView-Clicks/
USAGE:
ItemClickSupport.addTo(mRecyclerView).setOnItemClickListener(new ItemClickSupport.OnItemClickListener() {
@Override
public void onItemClicked(RecyclerView recyclerView, int position, View v) {
// do it
}
});
@saymagic
saymagic / GifDecoder.java
Created October 4, 2016 17:38 — forked from devunwired/GifDecoder.java
An optimized implementation of GifDecoder for Android devices.
/**
* Copyright (c) 2013 Xcellent Creations, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
@saymagic
saymagic / update-dnsmasq-from-gfwlist.py
Created August 12, 2017 15:42 — forked from rambolee/update-dnsmasq-from-gfwlist.py
升级 小米路由器3 可以ssh 可以 Shadowsocks [Tags]: 小米路由, 小米路由3, 小米路由器, 小米路由器3, ssh, shadowsocks
#!/usr/bin/env python
#coding=utf-8
#
# Generate a list of dnsmasq rules with ipset for gfwlist
#
# Copyright (C) 2014 http://www.shuyz.com
# Ref https://code.google.com/p/autoproxy-gfwlist/wiki/Rules
import urllib2
import re
@saymagic
saymagic / Ubuntu Install+Uninstall lamp
Created December 4, 2017 15:42 — forked from wangwy/Ubuntu Install+Uninstall lamp
Ubuntu下lamp(PHP+Mysql+Apache)搭建+完全卸载卸载方法
搭建:
收集自:http://www.cloudfly.info/archives/36
安装apache2
sudo apt-get install apache2
安装完成,运行如下命令重启下:
sudo /etc/init.d/apache2 restart
在浏览器里输入http://localhost或者是http://127.0.0.1,如果看到了“It works!“,那就说明Apache就成功的安装了,Apache的默认安装,会在/var下建立一个名为www的目录,这个就是Web目录了,所有要能过浏览器访问的Web文件都要放到这个目录里。