Skip to content

Instantly share code, notes, and snippets.

View egoist's full-sized avatar
🙏
Please support my open-source projects!

EGOIST egoist

🙏
Please support my open-source projects!
View GitHub Profile
@egoist
egoist / jquery to xxx.md
Last active January 7, 2016 08:08
Compile jQuery to XXX component

form jQuery:

<div class="bingo">
  <button>Say hi!</button>
</div>

<script>
  $('button').on('click', function () {
 console.log('hi')
@egoist
egoist / css-layout-no-flexbox.md
Last active February 8, 2016 06:04
CSS 布局(非 flexbox 篇)

单栏

<div class="container">
  css is awesome!  
</div>
.container {
upstream php {
server unix:/var/run/php5-fpm.sock;
}
server {
# enforce NO www
server_name www.example.com;
return 301 $scheme://example.com$request_uri;
}
@egoist
egoist / pgsql.md
Last active May 14, 2016 14:37
PostgreSQL 简明指南

安装

# ubuntu
$ sudo apt-get install postgresql

控制台

#! /usr/bin/env bash
# Usage: git-io URL [CODE]
#
# Turns a github.com URL
# into a git.io URL
URL="$1"
CODE="$2"
@nathggns
nathggns / stroke.scss
Created June 24, 2012 17:40
Text Stroke SCSS Mixin (SASS)
@mixin stroke($width, $color) {
$shadow: 0 0 0 transparent;
$i: 0;
@while ($i < $width) {
$i: $i + 1;
$j: 0;
@while ($j < 2) {
$j: $j + 1;
@rgrove
rgrove / README.md
Created February 8, 2016 19:01
Cake's approach to React Router server rendering w/code splitting and Redux

Can't share the complete code because the app's closed source and still in stealth mode, but here's how I'm using React Router and Redux in a large app with server rendering and code splitting on routes.

Server

  1. Wildcard Express route configures a Redux store for each request and makes an addReducers() callback available to the getComponents() method of each React Router route. Each route is responsible for adding any Redux reducers it needs when it's loaded. (This isn't really necessary on the

First of all, this is not my brilliant effort to get react-native working on Windows, it is the collation of work by others, particularly @mqli and @Bernd Wessels. I've just summarised what worked for me.

If you would prefer to read what I've plagerised, head over to mqli's great gist

Disclaimer

  • The below is tested with react-native-cli 0.1.5, react-native 0.12.0 on Windows 10, node 4.1.1, and Android (physical Nexus 6 and AVD with API v22)
  • I hope this will all be redundant in a few weeks. Please comment on stuff that is now fixed and I will update this to keep it relevant.
  • Sprinkle a bit of YMMV around

Keep this github issue handy, it’s the bucket for all Windows/Linux related tricks to get RN working.

@developit
developit / worlds-worst-jsx-transform.js
Created May 18, 2020 22:47
worlds-worst-jsx-transform.js
/**
* Write JSX, but make sure you have `import html from 'htm/preact'` in your files.
* Run them through this horrid attrocity and get JSX support with basically no overhead.
*/
export function transformJsxToHtm(code) {
const tokenizer = /(^|)(?:<\/([a-z$_][a-z0-9_.-:]*)>|<([a-z$_][a-z0-9_.-:]*)(\s+[a-z0-9._-]+(?:=(?:".*?"|'.*?'|\{.+?\}))?)*(\s*\/\s*)?>|<(\/?)>)/gi;
let out='', index=0, token;
let depth = 0;
let stacks = [];
let shouldPop = false;