<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
<atom:link href="https://codecodify.com/feed" rel="self" type="application/rss+xml" />
    <title>源码达人</title>
    <link>https://codecodify.com</link>
    <description>我是柠檬鱼，一个PHPer，热衷PHP和Golang技术。QQ：79627084，微信：rust-golang，公众号：技不离身，欢迎交流。</description>
    <language>zh-CN</language>
    <copyright>Copyright (c) 源码达人</copyright>
    <lastBuildDate>Fri, 06 Mar 2026 16:54:11 +0800</lastBuildDate>
    <item>
      <title>Go - 如何使用 Resty</title>
      <link>https://codecodify.com/post/how-to-use-resty-with-go</link>
      <description>&lt;![CDATA[Go - 如何使用Resty
介绍
RESTful API已成为现代Web开发的基石，实现了客户端和服务器之间的无缝通信。在本文中，我们将探索使用Resty这个流行的HTTP客户端库在Go中执行常见操作，如GET、POST、UPDATE和DELETE请求的强大和简单性。我们还将学习如何在请求中传递头部，以便自定义和增强我们的API交互。
安装Resty
首先，我们需要在Go环境中安装Resty。我们可以使用以下命令安...]]&gt;</description>
      <guid>https://codecodify.com/post/how-to-use-resty-with-go</guid>
      <pubDate>Tue, 18 Jul 2023 14:03:55 +0800</pubDate>
    </item>
    <item>
      <title>使用 gg 库实现文本生成</title>
      <link>https://codecodify.com/post/using-the-gg-library-to-achieve-text-generation</link>
      <description>&lt;![CDATA[需求
需要实现一个文本生成器，可以接受以下参数：

文本内容
字体路径
背景图片路径
字体大小

生成的文本需要以背景图片为底，将文本按照指定字体、大小进行绘制。
实现
为了实现上述需求，我使用了go语言中的gg库。gg库是一个轻量级的2D绘图库，提供了简单易用的API，可以方便地进行图形绘制。
具体实现步骤如下：

使用gg.NewContextWithFile()方法创建一个新的绘图上下文，同时指定背景图片路径。...]]&gt;</description>
      <guid>https://codecodify.com/post/using-the-gg-library-to-achieve-text-generation</guid>
      <pubDate>Fri, 14 Jul 2023 16:50:15 +0800</pubDate>
    </item>
    <item>
      <title>【设计模式】策略模式实现简单商品打折功能</title>
      <link>https://codecodify.com/post/design-mode--strategy-mode-to-implement-simple-product-discount-function</link>
      <description>&lt;![CDATA[需求
作为电子商务网站拥有者，提供产品折扣来吸引和留住客户非常重要。在本博客文章中，我们将探讨如何使用Go语言中的策略模式实现商品的简单打折功能。
实现
策略模式需要先定义一个打折的抽象接口，每一种打折算法都要实现该接口，打折方式分别是正常收费、打折收费和返利收费：
package cash

// Cash 现金收费接口
type Cash interface {
    AccessCash(money floa...]]&gt;</description>
      <guid>https://codecodify.com/post/design-mode--strategy-mode-to-implement-simple-product-discount-function</guid>
      <pubDate>Fri, 26 May 2023 17:00:08 +0800</pubDate>
    </item>
    <item>
      <title>【wasm】JS 与 c/c++ 交换数据</title>
      <link>https://codecodify.com/post/wasm-exchange-data-between-js-and-cc</link>
      <description>&lt;![CDATA[本文讨论如何在编译为WebAssembly模块后的C/C++程序和js之间进行数据交换。本质上js和WebAssembly共享相同的线性内存，这意味着js和WebAssembly可以在同一内存位置读写数据。
从js读取c/c++全局变量
编译后全局变量已经分配好内存，所以可以通过共享线性内存的偏移进行读写。
#ifdef __EMSCRIPTEN__

#include &amp;lt;emscripten.h&amp;gt;

#...]]&gt;</description>
      <guid>https://codecodify.com/post/wasm-exchange-data-between-js-and-cc</guid>
      <pubDate>Sun, 21 May 2023 18:15:06 +0800</pubDate>
    </item>
    <item>
      <title>【设计模式】使用 go 语言实现简单工厂模式</title>
      <link>https://codecodify.com/post/using-go-language-to-implement-simple-factory-pattern</link>
      <description>&lt;![CDATA[最近在看《大话设计模式》，这本书通过对话形式讲解设计模式的使用场景，有兴趣的可以去看一下。
第一篇讲的是简单工厂模式，要求输入两个数和运算符号，得到运行结果。
这个需求不难，难就难在类要怎么设计，才能达到可复用、维护性强、可拓展和灵活性高。
运算符可能是加、减、乘、除，未了方便以后可以拓展其它运算符，这里可以声明一个抽象接口，通过简单工厂设计模式返回不通的运算类。
package operate

type IOpe...]]&gt;</description>
      <guid>https://codecodify.com/post/using-go-language-to-implement-simple-factory-pattern</guid>
      <pubDate>Mon, 15 May 2023 13:59:51 +0800</pubDate>
    </item>
    <item>
      <title>【wasm】快速排序，并在小程序引用</title>
      <link>https://codecodify.com/post/quickly-sort-and-reference-in-mini-programs</link>
      <description>&lt;![CDATA[c语言部分
如果功能比较简单，可以直接使用WasmFiddle将 c/c++ 编译成 wasm。这个示例比较简单，先声明一个全局数组变量，由 js 写入和读取该变量。wasm 不仅可以导出函数，也可以从js导入函数，也就是在js实现由c/c++声明的 extern 函数。
// 定义待排序数组的大小
#define N 10

// 定义全局数组，在模块初始化时就在内存分配
int array[N];

// 定义j...]]&gt;</description>
      <guid>https://codecodify.com/post/quickly-sort-and-reference-in-mini-programs</guid>
      <pubDate>Mon, 01 May 2023 14:40:58 +0800</pubDate>
    </item>
    <item>
      <title>【wasm】自定义函数</title>
      <link>https://codecodify.com/post/wasm-custom-function</link>
      <description>&lt;![CDATA[c语言片段
新建文件名为side_module.c的文件

int Increment(int value) {
    return value + 1;
}

int Decrement(int value) {
    return value - 1;
}
O1编译
命令
emcc side_module.c -s SIDE_MODULE=2 -O1 -s EXPORTED_FUNCTIONS='["_Inc...]]&gt;</description>
      <guid>https://codecodify.com/post/wasm-custom-function</guid>
      <pubDate>Thu, 27 Apr 2023 14:21:43 +0800</pubDate>
    </item>
    <item>
      <title>【算法】字符串平移</title>
      <link>https://codecodify.com/post/algorithm-string-translation</link>
      <description>&lt;![CDATA[需求
我们规定，字符串平移是指将字符串最左边的字符移动到最右边，其他位置的字符保持不变。现在，输入两个字符串，尝试编程判断第2个字符串是否 可以由第1个
字符串平移得到。例如输入“hello”和“llohe”，则需要返回True作为答案，因为将“hello”平移一次将变成“elloh”，再平移一次就 会变成“llohe”。
思路
本题的核心在于如何进行字符串的平移操作。我们分析一下字符串平移的特点可以发现，每平移一次...]]&gt;</description>
      <guid>https://codecodify.com/post/algorithm-string-translation</guid>
      <pubDate>Mon, 22 Aug 2022 09:04:03 +0800</pubDate>
    </item>
    <item>
      <title>【算法】查找常用字符</title>
      <link>https://codecodify.com/post/algorithm-find-common-characters</link>
      <description>&lt;![CDATA[需求
输入一组字符串，将其中的常用字符查找出来，常用字符的定义为：所输入的一组字符串中，所有的字符串中都包含此字符，
则此字符就被定义为常用字符。例如，假设我们输入一组字符串为[&amp;quot;ball&amp;quot;, &amp;quot;gad&amp;quot;, &amp;quot;apple&amp;quot;]， 则最终需要返回[&amp;quot;a&amp;quot;]，
因为只有字符“a”在输入的3个字符串中都出现了。如果输入[&amp;quot;cool&amp;qu...]]&gt;</description>
      <guid>https://codecodify.com/post/algorithm-find-common-characters</guid>
      <pubDate>Mon, 22 Aug 2022 09:02:31 +0800</pubDate>
    </item>
    <item>
      <title>【算法】求最长不含重复字符的子字符串长度</title>
      <link>https://codecodify.com/post/algorithm-find-the-longest-substring-length-without-duplicate-characters</link>
      <description>&lt;![CDATA[需求
输入一个字符串，尝试编程找到其中最长的不包含重复字符的子字符串，并将其长度返回。例如，输入“aaa”，将返回1作为结果，
输入“abcabcbb”，将返回3作为结果。
思路
本题需要查找的是最长的不含重复字符的子串，首先可以先确定一个起始点，之后计算从此起始点向后截取可以得到的不含重复字符的最长子串的长度，
之后依次向后移动起始点，循环计算子串长度的操作，最终取长度最大的结果返回即可。核心思路可以总结如下：

...]]&gt;</description>
      <guid>https://codecodify.com/post/algorithm-find-the-longest-substring-length-without-duplicate-characters</guid>
      <pubDate>Mon, 22 Aug 2022 09:01:32 +0800</pubDate>
    </item>
    <item>
      <title>【算法】查找第一次出现的唯一字符</title>
      <link>https://codecodify.com/post/algorithm-find-the-first-unique-character</link>
      <description>&lt;![CDATA[需求
输入一个字符串，编程找到此字符串中第一次出现的唯一字符，尝试将其返回，如果字符串中不存在唯一字符，则返回空字符串。例如，输入“acddaeef”，
将返回“c”，因为字符“c”和“f”是字符串中的唯一字符，字符“c”是首次出现的。
思路
本题除了要找到字符串中的唯一字符外，更关键的是对唯一字符串出现的顺序进行记录，根据题目的要求，我们需要返回第一次出现的唯一字符。
因此，在设计算法时，我们可以采用两种不同的数据...]]&gt;</description>
      <guid>https://codecodify.com/post/algorithm-find-the-first-unique-character</guid>
      <pubDate>Mon, 22 Aug 2022 09:00:22 +0800</pubDate>
    </item>
    <item>
      <title>【算法】统计连续字符的长度</title>
      <link>https://codecodify.com/post/algorithm-count-the-length-of-continuous-characters</link>
      <description>&lt;![CDATA[需求
输入一个字符串，尝试编程返回其中最长的连续重复字符的长度。例如，输入字符串“abbbcdeff”，其中最长的连续重复字符组成的子串为“bbb”，
因此需要返回3作为答案。如果输入“hello”，需要返回2作为答案，因为其中最长的连续重复字符组成的子串为“ll”。
思路
本题是一道非常经典的字符串编程题。在编程工程师相关职位的面试中，本题的出场率也非常高。解题思路也比较简单，过程如下：

对字符串进行遍历，记录当...]]&gt;</description>
      <guid>https://codecodify.com/post/algorithm-count-the-length-of-continuous-characters</guid>
      <pubDate>Mon, 22 Aug 2022 08:59:05 +0800</pubDate>
    </item>
    <item>
      <title>【算法】分割字符串获取最大分数</title>
      <link>https://codecodify.com/post/algorithm-split-the-string-to-get-the-maximum-score</link>
      <description>&lt;![CDATA[需求
输入一个只有“0”和“1”组成的字符串，其长度不小于2，我们需要将其从某个位置分割成左右两个子串（子串的长度都大于0），
在左串中，每出现一个0，则计1分，在右串中，每出现一个1，则计1分，尝试编程计算出所有分割方案中最高可以得多少分，
并将分数返回。例如，如果输入“00111”，当分割的左子串为“00”，右子串为“111”时得分最高，为5分，我们需要返回5作为正确答案。
思路
根据题目中的要求，我们能够明确每...]]&gt;</description>
      <guid>https://codecodify.com/post/algorithm-split-the-string-to-get-the-maximum-score</guid>
      <pubDate>Mon, 22 Aug 2022 08:57:44 +0800</pubDate>
    </item>
    <item>
      <title>【算法】分割出回文字符串</title>
      <link>https://codecodify.com/post/algorithm-split-palindrome-string</link>
      <description>&lt;![CDATA[需求
要求输入一个字符串，将此字符串分割成一些子串，使每个子串都是回文串(单字符的字符串也属于回文串)。
例如输入字符串&amp;quot;abb&amp;quot;，则返回：
["a", "b", "b"],
["a", "bb"]，
思路
本题的核心是将字符串分割出多个回文的子字符串。判断某个字符串是不是回文字符串非常简单，我们直接将字符串进行逆序，然后判断与原字符串是否相同即可。
对字符串进行分割的过程实际上是一个递归的过程，...]]&gt;</description>
      <guid>https://codecodify.com/post/algorithm-split-palindrome-string</guid>
      <pubDate>Sun, 14 Aug 2022 10:47:48 +0800</pubDate>
    </item>
    <item>
      <title>【算法】平衡字符串的分割</title>
      <link>https://codecodify.com/post/algorithm-balanced-string-segmentation</link>
      <description>&lt;![CDATA[输入一个只包含“L”和“R”的字符串，并且其中&amp;quot;L&amp;quot;与&amp;quot;R&amp;quot;的个数是相等的。符合这种输入条件的字符串称为平衡字符串。尝试编程对输入的平衡字符串进行分割，
尽可能多地分割出平衡字符串子串，并将可以得到的子串数量返回。
例如，输入“RLLLRRRL”将返回3，其可以分割成“RL”、“LLRR”和“RL”。输入“LLLRRR”将返回1，因为其只能分割出“LLLRRR”。
思路
本题非...]]&gt;</description>
      <guid>https://codecodify.com/post/algorithm-balanced-string-segmentation</guid>
      <pubDate>Fri, 12 Aug 2022 08:54:56 +0800</pubDate>
    </item>
  </channel>
</rss>
