Skip to content

Instantly share code, notes, and snippets.

@jfcherng
jfcherng / st4-changelog.md
Last active February 26, 2026 10:28
Sublime Text 4 changelog just because it's not on the official website yet.
extension String {
func foregroundColor(_ color: UIColor) -> NSAttributedString {
NSAttributedString(string: self, attributes: [.foregroundColor : color])
}
func background(_ color: UIColor) -> NSAttributedString {
NSAttributedString(string: self, attributes: [.backgroundColor: color])
}
func underline(_ color: UIColor, style: NSUnderlineStyle = .single) -> NSAttributedString {
NSAttributedString(string: self, attributes: [.underlineColor: color, .underlineStyle: style.rawValue])
}
@imedadel
imedadel / index.js
Created May 26, 2019 09:06
An example of using React Hooks with jQuery and Chosen plugin. `Chosen` is the original example using a class and `Chosed` is the "modern" approach using functions and hooks.
const Chosed = (props) => {
const elmt = React.useRef()
React.useLayoutEffect(()=>{
const $elmt = $(elmt.current)
const handleChange = (e) => {
props.onChange(e.target.value);
}
$elmt.chosen()
@Bigigrammer
Bigigrammer / HTML_to_NSAttributedString.swift
Last active June 30, 2024 07:42
This extension convert HTML to NSAttributedString each other. It works on Swift4.
extension String {
func convertAttributedString() -> NSAttributedString?{
let html = self._removePT()
let encoded = html.data(using: String.Encoding.utf8)!
let attributedOptions : [NSAttributedString.DocumentReadingOptionKey : Any] = [
.documentType : NSAttributedString.DocumentType.html,
.characterEncoding : String.Encoding.utf8.rawValue
]
do {
let attributedTxt = try NSAttributedString(data: encoded, options: attributedOptions, documentAttributes: nil)
@heamon7
heamon7 / tushare-dash-kline.py
Created October 31, 2017 12:39
tushare-dash-kline
# coding: utf-8
import dash
import dash_core_components as dcc
import dash_html_components as html
import colorlover as cl
import datetime as dt
import flask
import os
import pandas as pd
{
"libs":[
"browser",
"chai",
"ecma5",
"ecma6",
"jquery",
"underscore"
],
"plugins": {

This is unmaintained, please visit Ben-PH/spacemacs-cheatsheet

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
@Zearin
Zearin / python_decorator_guide.md
Last active March 10, 2026 15:21
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.


Q: How can I make a chain of function decorators in Python?


If you are not into long explanations, see [Paolo Bergantino’s answer][2].

@niccokunzmann
niccokunzmann / example.py
Last active March 1, 2023 15:52
You can use while and for loops without blocking the GUI. This is currently for Tkinter and PyQT. To install guiLoop copy the guiLoop.py file into the directory of your script.
## MIT License
##
## Copyright 2014 Nicco Kunzmann
##
## Permission is hereby granted, free of charge, to any person obtaining a copy of this
## software and associated documentation files (the "Software"), to deal in the Software
## without restriction, including without limitation the rights to use, copy, modify, merge,
## publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
## to whom the Software is furnished to do so, subject to the following conditions:
##