Skip to content

Instantly share code, notes, and snippets.

View einSelbst's full-sized avatar
💭
Me, looking through the window of opportunity.

einSelbst einSelbst

💭
Me, looking through the window of opportunity.
  • Berlin / BalticSea
View GitHub Profile
@redinger
redinger / Emacs.md
Created November 26, 2011 03:22
Setting up Emacs daemon on OS X

Setting up Emacs daemon on OS X

Tired of waiting for emacs to start on OS X? This step by step guide will teach you how to install the latest version of emacs and configure it to start in the background (daemon mode) and use emacsclient as your main editor.

Install Cocoa Emacs

Download the latest pretest version of [Emacs for Mac OS X]: http://emacsformacosx.com/builds

@domenic
domenic / interop.md
Last active July 7, 2022 19:47
`module.exports =` and ES6 Module Interop in Node.js

module.exports = and ES6 Module Interop in Node.js

The question: how can we use ES6 modules in Node.js, where modules-as-functions is very common? That is, given a future in which V8 supports ES6 modules:

  • How can authors of function-modules convert to ES6 export syntax, without breaking consumers that do require("function-module")()?
  • How can consumers of function-modules use ES6 import syntax, while not demanding that the module author rewrites his code to ES6 export?

@wycats showed me a solution. It involves hooking into the loader API to do some rewriting, and using a distinguished name for the single export.

This is me eating crow for lots of false statements I've made all over Twitter today. Here it goes.

@Envek
Envek / pg_interval_support_4_1.rb
Last active December 18, 2023 14:41
Enables PostgreSQL interval datatype support (as ActiveSupport::Duration) in Ruby on Rails from 4.1 to 6.0
# Enables PostgreSQL interval datatype support (as ActiveSupport::Duration) in Ruby on Rails 4.1.
# Based on https://gist.github.com/clarkdave/6529610
require 'active_support/duration'
# add a native DB type of :interval
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:interval] = { name: 'interval' }
# add the interval type to the simplified_type list. because this method is a case statement
# we can't inject anything into it, so we create an alias around it so calls to it will call
@metasean
metasean / README.md
Created June 30, 2017 03:09
How to share a webpack config between next.js and Storybook
# config/initializers/activestorage.rb
Rails.application.config.to_prepare do
# Provides the class-level DSL for declaring that an Active Record model has attached blobs.
ActiveStorage::Attached::Macros.module_eval do
def has_one_attached(name, dependent: :purge_later, acl: :private)
class_eval <<-CODE, __FILE__, __LINE__ + 1
def #{name}
@active_storage_attached_#{name} ||= ActiveStorage::Attached::One.new("#{name}", self, dependent: #{dependent == :purge_later ? ":purge_later" : "false"}, acl: "#{acl}")
end
@rafasashi
rafasashi / php languages array
Created July 7, 2018 08:52
PHP var_export of 180+ languages with data including name, native, iso codes, language family, language script, language cultures, and other attributes
array (
'aa' =>
array (
'name' => 'Afar',
'native' => 'Afaraf',
'iso_639_1' => 'aa',
'iso_639_2' => 'aar',
'iso_639_3' => 'aar',
'script' =>
@pedrouid
pedrouid / iso-639-1.json
Last active August 23, 2022 22:41
ISO-639-1 Languages (including matching ISO-639-1, ISO-639-2B, ISO-639-2T and ISO-639-3 codes)
[
{
"name": "Afar",
"type": "living",
"scope": "individual",
"iso-639-3": "aar",
"iso-639-2B": "aar",
"iso-639-2T": "aar",
"iso-639-1": "aa"
},
@AJolly
AJolly / bitmexusd.user.js
Last active September 12, 2019 01:51 — forked from QuantBits/script.js
BitMex USD Converter - For TemperMonkey
// ==UserScript==
// @name BitMex USD Converter
// @namespace https://bitmex.com/
// @version 0.13
// @description Get some sanity into your gambling.
// @author koinkraft, modified by @Jolly - https://www.twitter.com/Jolly
// @grant none
// @include https://bitmex.com/*
// @include https://www.bitmex.com/*
// @require https://code.jquery.com/jquery-2.1.4.min.js
@azu
azu / amp.d.ts
Last active November 19, 2022 06:08
TypeScript definitions for AMP Attributes. Write AMP in JSX.
// roughish AMP attribute types for JSX/TypeScript
// Source: https://playground.amp.dev/amphtml-hint.json
// https://github.com/Microsoft/TypeScript/issues/15449
// https://stackoverflow.com/questions/50585952/typescript-and-google-amp-property-amp-img-does-not-exist-on-type-jsx-intrin
import * as React from 'react';
// why null ?
type _ANY = any;
type _ANYS = any;
declare module 'react' {
interface HTMLAttributes<T> {
@rangeoshun
rangeoshun / config.el
Last active June 12, 2023 15:45
Typescript with CSS in JS (styled-components, Emotion), JSX and graphql highlight and major mode for Emacs Doom with `mmm-mode` for *.tsx
;; Assign typescript-mode to .tsx files
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-mode))
(require 'mmm-mode)
(setq mmm-global-mode t)
(setq mmm-submode-decoration-level 0) ;; Turn off background highlight
;; Add css mode for CSS in JS blocks
(mmm-add-classes
'((mmm-styled-mode