Skip to content

Instantly share code, notes, and snippets.

View afc163's full-sized avatar
🎃
Closing issues

afc163 afc163

🎃
Closing issues
View GitHub Profile
@aoxu
aoxu / forward.sh
Created September 29, 2016 03:01
forward socks5 to http/https
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install privoxy
vim /usr/local/etc/privoxy/config
forward-socks5 / 127.0.0.1:1080 .
brew services start privoxy
export https_proxy=http://127.0.0.1:8118;export http_proxy=http://127.0.0.1:8118
@usagimaru
usagimaru / NSImage+TintColor.swift
Last active October 12, 2023 13:39
NSImage+TintColor
import Cocoa
// This will work with Swift 5
extension NSImage {
func image(with tintColor: NSColor) -> NSImage {
if self.isTemplate == false {
return self
}
let image = self.copy() as! NSImage
@chrisladd
chrisladd / text.js
Created February 9, 2016 19:56
Text Rendering for Sketch
// text.js
function replaceSubstring(inSource, inToReplace, inReplaceWith) {
var outString = inSource;
while (true) {
var idx = outString.indexOf(inToReplace);
if (idx == -1) {
break;
}
@ChristopherBiscardi
ChristopherBiscardi / gatsby.config.js
Created January 20, 2016 19:02
Extracting Stylesheets with Gatsby
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = function(config, env) {
if(env === 'static') {
config.removeLoader('css');
config.loader('css', function(cfg) {
cfg.test = /\.css$/;
cfg.loader = ExtractTextPlugin.extract('css?minimize');
return cfg
})
@tejacques
tejacques / HOCBaseRender.tsx
Last active May 2, 2022 13:05
React Higher Order Components in TypeScript
import * as React from 'react';
import { Component } from 'react';
export default function HOCBaseRender<Props, State, ComponentState>(
Comp: new() => Component<Props & State, ComponentState>) {
return class HOCBase extends Component<Props, State> {
render() {
return <Comp {...this.props} {...this.state}/>;
}
}
@janlay
janlay / README.md
Last active March 4, 2024 05:25
Yet another config for Surge.app

Install

  1. Modify index.txt with your output path and proxy info
  2. Use Text Builder to build configuration for Surge: $ text-builder -index /path/to/index.txt Or run $ sh build-all to build all your index files.
  3. Import configuration via AirDrop/iTunes/Dropbox/iCloud

本人不提供任何保证和技术支持,使用者自负风险。
There are no guarantees, no any support. Use it at your own risk.

@julianocomg
julianocomg / AffixWrapper.jsx
Last active November 28, 2022 14:59
A simple affix React component.
/**
* @author Juliano Castilho <julianocomg@gmail.com>
*/
var React = require('react');
var AffixWrapper = React.createClass({
/**
* @type {Object}
*/
propTypes: {
@paulirish
paulirish / bling.js
Last active May 1, 2024 19:56
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@randyburden
randyburden / CodeMirror_CurlyBraceWrappedText_Demo
Created October 21, 2014 23:21
CodeMirror Custom Syntax Highlighter for highlighting double curly brace wrapped text aka Mustache / Handlebars
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CurlyBraceWrappedText Demo</title>
<style type="text/css">
.CodeMirror {border: 1px solid black;}
.cm-CurlyBraceWrappedText {color: #CC0000; font-weight: bold;}
</style>
<link rel="stylesheet" href="css/codemirror.css">
@davidhund
davidhund / feature-detect flexbox.js
Last active October 17, 2019 16:02
The simplest feature-detect for flexbox?
/*
* Trying to feature-detect (very naive)
* CSS Flexbox support.
* - Only most modern syntax
*
* Is this nonsense?
*/
(function NaiveFlexBoxSupport(d){
var f = "flex", e = d.createElement('b');