Skip to content

Instantly share code, notes, and snippets.

View cgfeel's full-sized avatar
😀
working...

快乐的小萌新 cgfeel

😀
working...
  • 米圭
  • 上海
View GitHub Profile
@thecrypticace
thecrypticace / index.html
Created May 19, 2022 23:28
Square Root in CSS
<meta charset="utf-8">
<style>
.square-root {
--n: 0;
--guess-0: 1;
--guess-1: calc(0.5 * calc(var(--guess-0) + calc(var(--n) / var(--guess-0))));
--guess-2: calc(0.5 * calc(var(--guess-1) + calc(var(--n) / var(--guess-1))));
--guess-3: calc(0.5 * calc(var(--guess-2) + calc(var(--n) / var(--guess-2))));
--guess-4: calc(0.5 * calc(var(--guess-3) + calc(var(--n) / var(--guess-3))));
@joeldenning
joeldenning / Instructions.md
Last active March 4, 2024 09:05
create-react-app + react-app-rewired + single-spa

This Gist works for CRA 3. For CRA 4, you can try community maintained craco plugin for converting to a single-spa application at https://github.com/hasanayan/craco-plugin-single-spa-application (thanks @hasanayan):

  1. Install react-app-rewired, as explained in https://github.com/timarney/react-app-rewired.
  2. Create a file in src called single-spa-entry.js (or tsx for typescript)
  3. Modify config-overrides.js, as shown in the config-overrides.js file provided in this gist.
  4. (Optional) remove src/main.js, since single-spa-entry is the new entry
  5. (Optional) remove public/index.html, since single-spa applications share a single html file, instead of one html file per project.
@ragingwind
ragingwind / nginx.conf
Created August 5, 2019 09:19
Redirect old-classic browser including IE 11
worker_processes 1;
events {
worker_connections 1024;
}
http {
map $http_user_agent $outdated {
default 0;
"~MSIE [1-10]\." 1;
@expressiveco
expressiveco / MyWeb.js
Last active June 27, 2023 15:36
Refreshing React Native WebView to initial url
export default class MyWeb extends Component {
mainUrl = "https://facebook.github.io/";
state = {
url: this.mainUrl,
};
render() {
return [
<WebView
key="comp1"
@giautm
giautm / build-id.js
Created June 14, 2018 08:09
Next.JS Build-ID with last git commit
const fs = require('fs')
const path = require('path')
const { execFile } = require('child_process')
function lastCommitId(dir) {
return new Promise((resolve, reject) => {
const gitArgs = [
`--git-dir=${path.join(dir, '.git')}`,
`--work-tree=${dir}`,
'rev-parse',
@anthonyeden
anthonyeden / wordpress-date.php
Last active May 8, 2023 07:38
Wordpress Date() and StrToTime() Functions
<?php
function wp_date_localised($format, $timestamp = null) {
// This function behaves a bit like PHP's Date() function, but taking into account the Wordpress site's timezone
// CAUTION: It will throw an exception when it receives invalid input - please catch it accordingly
// From https://mediarealm.com.au/
$tz_string = get_option('timezone_string');
$tz_offset = get_option('gmt_offset', 0);
@axetroy
axetroy / README.md
Last active January 18, 2024 15:28
nginx接口转发/代理/单页面应用配置

关于nginx的小小笔记

不常用,没过一段时间都要去搜一下,干脆自己记下来

重启nginx服务器

/etc/init.d/nginx restart
# or
service nginx restart
@chourobin
chourobin / 0-bridging-react-native-cheatsheet.md
Last active May 4, 2024 14:06
React Native Bridging Cheatsheet
@kocisov
kocisov / next_nginx.md
Last active April 10, 2024 14:27
How to setup next.js app on nginx with letsencrypt
@mfmendiola
mfmendiola / ArrayUtil.java
Last active April 5, 2023 19:10
ReadableArray and ReadableMap serialization helpers for the React Native—Android bridge.
/*
ArrayUtil exposes a set of helper methods for working with
ReadableArray (by React Native), Object[], and JSONArray.
MIT License
Copyright (c) 2020 Marc Mendiola
Permission is hereby granted, free of charge, to any person obtaining a copy