This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| def findFilesRecursively(path, pred = None, ls = None): | |
| if ls == None: | |
| ls = [] | |
| for p in os.listdir(path): | |
| p = os.path.join(path, p) | |
| if os.path.isdir(p): | |
| findFilesRecursively(p, pred, ls) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const app = express(); | |
| app.all('*',function (req, res, next) { | |
| res.header('Access-Control-Allow-Origin', '*'); | |
| res.header('Access-Control-Allow-Headers', 'Content-Type, Content-Length, Authorization, Accept, X-Requested-With , yourHeaderFeild'); | |
| res.header('Access-Control-Allow-Methods', 'PUT, POST, GET, DELETE, OPTIONS'); | |
| if (req.method == 'OPTIONS') { | |
| console.log('---------------->'); | |
| res.send(200); /let options req pass quickly/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local file_ext = require('file_ext') | |
| local table_ext = require('table_ext') | |
| local tmp_file = 'listfile.tmp.000' | |
| function downloadDir(server, user, password, server_path, local_path) | |
| if os.execute(string.format('curl -l "%s/%s/" --user %s:%s > %s', server, server_path, user, password, tmp_file)) then | |
| local lines = file_ext.readLines(tmp_file) | |
| util.pathRemove(tmp_file) | |
| table_ext.foreach(lines, function (k, v) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Util methods | |
| public static void editTextSetContentMemorizeSelection(EditText editText, CharSequence charSequence) { | |
| int selectionStart = editText.getSelectionStart(); | |
| int selectionEnd = editText.getSelectionEnd(); | |
| editText.setText(charSequence.toString()); | |
| if (selectionStart > charSequence.toString().length()) { | |
| selectionStart = charSequence.toString().length(); | |
| } | |
| if (selectionStart < 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Nullable | |
| @Override | |
| public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | |
| View rootView = inflater.inflate(getLayout(), container); | |
| editText.requestFocus(); | |
| getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); | |
| return rootView; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <android.support.v4.widget.NestedScrollView | |
| android:id="@+id/scroll" | |
| android:layout_width="match_parent" | |
| android:layout_height="wrap_content" | |
| android:paddingTop="?attr/actionBarSize" | |
| android:clipToPadding="false"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| editText.setFilters(new InputFilter[] { | |
| new InputFilter() { | |
| @Override | |
| public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { | |
| if (!somePattern.matcher(source).matches()) { | |
| //return empty to refuse | |
| return ""; | |
| } else { | |
| //return null if accept | |
| return null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { | |
| @Override | |
| public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { | |
| } | |
| @Override | |
| public void onPageSelected(int position) { | |
| invalidateActionbar(position); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <resources> | |
| <integer name="design_snackbar_text_max_lines">5</integer> | |
| </resources> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void applyDim(@NonNull Activity activity){ | |
| float dimAmount = 0.5f; | |
| ViewGroup rootView = (ViewGroup) (activity.getWindow().getDecorView().getRootView()); | |
| Drawable dim = new ColorDrawable(Color.BLACK); | |
| dim.setBounds(0, 0, rootView.getWidth(), rootView.getHeight()); | |
| dim.setAlpha((int) (255 * dimAmount)); | |
| ViewGroupOverlay overlay = rootView.getOverlay(); | |
| overlay.add(dim); | |
| } |
OlderNewer