AndyM129 / CodeSnippets

常用的代码模板/片断

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AndyM129/CodeSnippets

Introduction

  • 常用的代码模板/片断

Features

使用该库,可以在编码时 通过快捷输入 键入对应的代码片段/模板,以提升开发效率及质量,如:

C 相关

  • amk_cs_array_count.codesnippet
  • amk_cs_calloc_int.codesnippet
  • amk_cs_calloc.codesnippet
  • amk_cs_char_chars.codesnippet
  • amk_cs_char_str_2.codesnippet
  • amk_cs_char_str.codesnippet
  • amk_cs_char_strs.codesnippet
  • amk_cs_const.codesnippet
  • amk_cs_define_max.codesnippet
  • amk_cs_define.codesnippet
  • amk_cs_enum_2.codesnippet
  • amk_cs_enum_3.codesnippet
  • amk_cs_enum.codesnippet
  • amk_cs_exercise.codesnippet
  • amk_cs_fgets.codesnippet
  • amk_cs_func.codesnippet
  • amk_cs_if_defined.codesnippet
  • amk_cs_if.codesnippet
  • amk_cs_ifdef.codesnippet
  • amk_cs_ifndef.codesnippet
  • amk_cs_include_ctype.codesnippet
  • amk_cs_include_math.codesnippet
  • amk_cs_include_stdbool.codesnippet
  • amk_cs_include_stdio.codesnippet
  • amk_cs_include_stdlib.codesnippet
  • amk_cs_include_string.codesnippet
  • amk_cs_is_leap.codesnippet
  • amk_cs_main_2.codesnippet
  • amk_cs_main.codesnippet
  • amk_cs_malloc.codesnippet
  • amk_cs_sprintf.codesnippet
  • amk_cs_struct.codesnippet
  • amk_cs_swap_2.codesnippet
  • amk_cs_swap_3.codesnippet
  • amk_cs_swap.codesnippet
  • amk_cs_typedef_struct.codesnippet
  • amk_cs_undef.codesnippet
  • amk_cs_union.codesnippet

OC 相关

  • amk_cs_action_with_sender.codesnippet
  • amk_cs_action.codesnippet
  • amk_cs_category_subclassing_hooks_implementation.codesnippet
  • amk_cs_category_subclassing_hooks_interface.codesnippet
  • amk_cs_define_custom_log.codesnippet
  • amk_cs_define_if_elif_else_endif.codesnippet
  • amk_cs_define_log_for_debug_with_time.codesnippet
  • amk_cs_define_log_for_debug.codesnippet
  • amk_cs_handle_notification.codesnippet
  • amk_cs_initialize.codesnippet
  • amk_cs_jxpager_list_view_controller_pragma_mark.codesnippet
  • amk_cs_jxpager_view_controller_pragma_mark.codesnippet
  • amk_cs_mas_make_centerY_equal_to.codesnippet
  • amk_cs_mas_make_constraints.codesnippet
  • amk_cs_mas_make_height_equal_to.codesnippet
  • amk_cs_mas_make_right_equal_to.codesnippet
  • amk_cs_mas_make_width_equal_to.codesnippet
  • amk_cs_mas_remake_constraints.codesnippet
  • amk_cs_mas_update_constraints.codesnippet
  • amk_cs_method_with_completion.codesnippet
  • amk_cs_method_with_error.codesnippet
  • amk_cs_ns_assert_attempting_to_do.codesnippet
  • amk_cs_ns_assert_expected.codesnippet
  • amk_cs_ns_assert_invoke_abstract_class_method.codesnippet
  • amk_cs_ns_assert_must_be_initialized_with_xxx.codesnippet
  • amk_cs_ns_error_with_domain.codesnippet
  • amk_cs_ns_object_descriptions_by_value.codesnippet
  • amk_cs_ns_object_pragma_mark.codesnippet
  • amk_cs_params_block_implementation.codesnippet
  • amk_cs_params_block_interface.codesnippet
  • amk_cs_placeholder_image_url.codesnippet
  • amk_cs_property_assign_readonly.codesnippet
  • amk_cs_property_assign_readwrite.codesnippet
  • amk_cs_property_strong_readonly.codesnippet
  • amk_cs_property_strong_readwrite.codesnippet
  • amk_cs_regex_matches.codesnippet
  • amk_cs_runtime_copy_ivar_list.codesnippet
  • amk_cs_runtime_copy_property_list.codesnippet
  • amk_cs_runtime_get_associated_object.codesnippet
  • amk_cs_runtime_set_association_assign.codesnippet
  • amk_cs_runtime_set_association_copy_nonatomic.codesnippet
  • amk_cs_runtime_set_association_copy.codesnippet
  • amk_cs_runtime_set_association_retain_nonatomic.codesnippet
  • amk_cs_runtime_set_association_retain.codesnippet
  • amk_cs_runtime_swizzle_class_method.codesnippet
  • amk_cs_runtime_swizzle_instance_method.codesnippet
  • amk_cs_strong_self.codesnippet
  • amk_cs_swizzle_instance_method.codesnippet
  • amk_cs_ui_button_with_type.codesnippet
  • amk_cs_ui_collection_view_data_source_protocol_implementation.codesnippet
  • amk_cs_ui_collection_view_delegate_flow_layput_protocol_implementation.codesnippet
  • amk_cs_ui_collection_view_delegate_protocol_implementation.codesnippet
  • amk_cs_ui_collection_view_lazyload.codesnippet
  • amk_cs_ui_collection_view_property.codesnippet
  • amk_cs_ui_collection_view_protocol.codesnippet
  • amk_cs_ui_color_image_background.codesnippet
  • amk_cs_ui_color_random_bg.codesnippet
  • amk_cs_ui_image_view_alloc_init.codesnippet
  • amk_cs_ui_label_alloc_init.codesnippet
  • amk_cs_ui_table_view_cell.codesnippet
  • amk_cs_ui_table_view_data_source_protocol_implementation_for_editing.codesnippet
  • amk_cs_ui_table_view_data_source_protocol_implementation_for_index.codesnippet
  • amk_cs_ui_table_view_data_source_protocol_implementation.codesnippet
  • amk_cs_ui_table_view_delegate_protocol_implementation.codesnippet
  • amk_cs_ui_table_view_header_footer_view.codesnippet
  • amk_cs_ui_table_view_lazyload.codesnippet
  • amk_cs_ui_table_view_property.codesnippet
  • amk_cs_ui_table_view_protocol.codesnippet
  • amk_cs_ui_view_closest_common_superview.codesnippet
  • amk_cs_ui_view_controller_pragma_mark.codesnippet
  • amk_cs_ui_view_layer_corner_radius.codesnippet
  • amk_cs_ui_view_layer_mask_shape_by_rounding_corners.codesnippet
  • amk_cs_ui_view_layer_mask_shape.codesnippet
  • amk_cs_ui_view_layer_shadow.codesnippet
  • amk_cs_ui_view_pragma_mark.codesnippet
  • amk_cs_ui_view_reuse_identifier.codesnippet
  • amk_cs_ui_view_update_constraints.codesnippet
  • amk_cs_unowned_let_property_declare.codesnippet
  • amk_cs_warning_ignored_available.codesnippet
  • amk_cs_warning_ignored_deprecated.codesnippet
  • amk_cs_warning_ignored_undeclared_selector.codesnippet
  • amk_cs_warning_ignored_unused_function.codesnippet
  • amk_cs_weak_self.codesnippet
  • amk_cs_wkn_view_controller_implementation.codesnippet

Swift 相关

  • amk_cs_any_mark.codesnippet
  • amk_cs_anyobject_mark.codesnippet
  • amk_cs_blur_effect.codesnippet
  • amk_cs_button.codesnippet
  • amk_cs_class_protocol.codesnippet
  • amk_cs_closure_example.codesnippet
  • amk_cs_dispatch_main_async.codesnippet
  • amk_cs_dispatch_main_sync.codesnippet
  • amk_cs_do_try_catch.codesnippet
  • amk_cs_enum_character.codesnippet
  • amk_cs_enum_int.codesnippet
  • amk_cs_for_in_array_2.codesnippet
  • amk_cs_for_in_array.codesnippet
  • amk_cs_guard.codesnippet
  • amk_cs_if_else.codesnippet
  • amk_cs_label.codesnippet
  • amk_cs_lazy_var_closure_property_declare.codesnippet
  • amk_cs_let_property_declare.codesnippet
  • amk_cs_mark.codesnippet
  • amk_cs_protocol.codesnippet
  • amk_cs_string_format.codesnippet
  • amk_cs_table_view_data_source.codesnippet
  • amk_cs_table_view_delegate_for_editing.codesnippet
  • amk_cs_table_view_delegate.codesnippet
  • amk_cs_table_view.codesnippet
  • amk_cs_timer_with_runloop.codesnippet
  • amk_cs_unowned_var_property_declare.codesnippet
  • amk_cs_var_property_declare.codesnippet*

Example

Requirements

  • 暂无

Installation

可在任意路径下,通过终端执行以下命令,均会将代码片段安装该库到 Xcode 的目录下, 重启后即可生效使用:

curl -fsSL https://raw.githubusercontent.com/AndyM129/CodeSnippets/master/install.sh | sh

How to use

调试模式

该模式下,会打印执行过程中的相关参数及调试信息:

curl -O https://raw.githubusercontent.com/AndyM129/CodeSnippets/master/install.sh && bash install.sh -d

示例:

Andys-MacBook-Pro-2018:~ mengxinxin$ curl -O https://raw.githubusercontent.com/AndyM129/CodeSnippets/master/install.sh && bash install.sh -d
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3493  100  3493    0     0   1857      0  0:00:01  0:00:01 --:--:--  1857
----- variables -----
debug: true
edit: false
verbose: false

准备为您安装 CodeSnippets,路径为:/Users/mengxinxin/Library/Developer/Xcode/UserData/CodeSnippets
开始拉取最新的 CodeSnippets ...
Cloning into '/Users/mengxinxin/Library/Developer/Xcode/UserData/CodeSnippets.gitclone'...
remote: Enumerating objects: 26, done.
remote: Counting objects: 100% (26/26), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 89 (delta 17), reused 14 (delta 6), pack-reused 63
Unpacking objects: 100% (89/89), done.
moving codesnippets to dir:
	amk_cs_table_view_data_source_protocol_implementation_for_index.codesnippet
	amk_cs_table_view_data_source_protocol_implementation.codesnippet
	amk_cs_pragma_mark_for_view_controller.codesnippet
	amk_cs_collection_view_delegate_flow_layput_protocol_implementation.codesnippet
	amk_cs_table_view_data_source_protocol_implementation_for_editing.codesnippet
	amk_cs_table_view_property.codesnippet
	amk_cs_weak_self.codesnippet
	amk_cs_define_if_elif_else_endif.codesnippet
	amk_cs_property_strong_readonly.codesnippet
	amk_cs_collection_view_protocol.codesnippet
	amk_cs_collection_view_data_source_protocol_implementation.codesnippet
	amk_cs_property_strong_readwrite.codesnippet
	amk_cs_table_view_protocol.codesnippet
	amk_cs_shape_layer_mask.codesnippet
	amk_cs_collection_view_lazyload.codesnippet
	amk_cs_property_assign_readwrite.codesnippet
	amk_cs_collection_view_delegate_protocol_implementation.codesnippet
	amk_cs_table_view_lazyload.codesnippet
	amk_cs_action_with_sender.codesnippet
	amk_cs_pragma_mark_for_object.codesnippet
	amk_cs_pragma_mark_for_view.codesnippet
	amk_cs_pragma_mark_for_jxpager_view_controller.codesnippet
	amk_cs_property_assign_readonly.codesnippet
	amk_cs_action_without_sender.codesnippet
	amk_cs_shape_layer_mask_by_rounding_corners.codesnippet
	amk_cs_define_log_for_debug_with_time.codesnippet
	amk_cs_property_collection_view.codesnippet
	amk_cs_table_view_delegate_protocol_implementation.codesnippet
	amk_cs_params_block_implementation.codesnippet
	amk_cs_params_block_interface.codesnippet
	amk_cs_define_log_for_debug.codesnippet
	amk_cs_pragma_mark_for_jxpager_list_view_controller.codesnippet
	amk_cs_strong_self.codesnippet
已成功拉取最新的 CodeSnippets,须重启 Xcode 后生效。\n\n
Andys-MacBook-Pro-2018:~ mengxinxin$ 

编辑模式

该模式下,会备份已存在的代码片段目录,然后重新 clone 整个工程,以便编辑、新增工程文件:

curl -O https://raw.githubusercontent.com/AndyM129/CodeSnippets/master/install.sh && bash install.sh -e

示例:

Andys-MacBook-Pro-2018:~ mengxinxin$ curl -O https://raw.githubusercontent.com/AndyM129/CodeSnippets/master/install.sh && bash install.sh -e
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3493  100  3493    0     0    503      0  0:00:06  0:00:06 --:--:--   751
准备为您安装 CodeSnippets,路径为:/Users/mengxinxin/Library/Developer/Xcode/UserData/CodeSnippets
CodeSnippets 文件夹存在,已为您进行备份:/Users/mengxinxin/Library/Developer/Xcode/UserData/CodeSnippets.bak2020061913371592545047
开始拉取最新的 CodeSnippets ...
Cloning into '/Users/mengxinxin/Library/Developer/Xcode/UserData/CodeSnippets'...
remote: Enumerating objects: 26, done.
remote: Counting objects: 100% (26/26), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 89 (delta 17), reused 14 (delta 6), pack-reused 63
Unpacking objects: 100% (89/89), done.
已成功拉取最新的 CodeSnippets,须重启 Xcode 后生效。\n\n
Andys-MacBook-Pro-2018:~ mengxinxin$ 

Author

AndyMeng, andy_m129@163.com

Collaboration

Feel free to collaborate with ideas, issues and/or pull requests.

License

CodeSnippets is available under the MIT license. See the LICENSE file for more info.

About

常用的代码模板/片断

License:MIT License


Languages

Language:Shell 100.0%