Skip to content

Instantly share code, notes, and snippets.

View LinZap's full-sized avatar
🔬
copilot

Zap LinZap

🔬
copilot
View GitHub Profile
@robertgonzales
robertgonzales / Frame.js
Created December 12, 2017 03:03
Use React portals to render inside shadow dom and iframes
class Frame extends Component {
componentDidMount() {
this.iframeHead = this.node.contentDocument.head
this.iframeRoot = this.node.contentDocument.body
this.forceUpdate()
}
render() {
const { children, head, ...rest } = this.props
return (
create function fn_split(@str nvarchar(max),@separator as nvarchar(max))
returns @splits table(segment nvarchar(max))
as
begin
declare @anchor int=CHARINDEX(@separator,@str),@gram int=len(@separator)
while @anchor>0 and @gram<=len(@str)
begin
insert into @splits values(SUBSTRING(@str, 1, @anchor-1))
set @str=SUBSTRING(@str,@anchor+@gram,len(@str)-@anchor+@gram+1)
set @anchor=CHARINDEX(@separator,@str)
@LinZap
LinZap / formdata.js
Last active October 22, 2019 02:12
formdata v2.0
/**
* create by Zap Lin
* this is a magic function for collecting form data and convert it to object
*
* ref: https://developer.mozilla.org/zh-TW/docs/Web/API/FormData/FormData
*/
/**
* collecting data from <form> element and convert to Object (JSON)