Skip to content

Instantly share code, notes, and snippets.

String.prototype.capitalize = ->
@charAt(0).toUpperCase() + @slice(1)
parse_shit_to_date = (shit) ->
# shit in form of "2012-05-23"
parts = shit.match(/(\d+)/g)
new Date(parts[0], parts[1]-1, parts[2])
jQuery(document).ready ($) ->
return unless $("body.admin_dashboard").length
@abteilung
abteilung / TYPO3-reduce-CSS-Classes
Created April 7, 2013 15:42
TYPO3-CSS-Klassen entfernen aufräumen. Kein class="bodyTag" oder class="csc-firstHeader".
lib {
parseFunc_RTE {
nonTypoTagStdWrap.encapsLines {
### entfernt "class=bodytext" aus p-Tags
addAttributes.P.class =
}
}
stdheader {
### entfernt div-Tag um Headlines
stdWrap.dataWrap = |
@jsebrech
jsebrech / accessors.php
Created September 28, 2013 08:45
Demo of something like C# accessors in PHP using meta-programming
<?php
// requires PHP 5.4
trait ClassAccessors {
public function __set($name, $value) {
$methodName = "set".ucfirst($name);
if (method_exists($this, $methodName)) {
$this->$methodName($value);
} else {
anonymous
anonymous / .css
Created February 5, 2016 16:40
abbr[title],
acronym[title],
dfn[title] {
border-bottom: 1px dotted #000;
}
@supports (text-decoration: dotted underline) {
abbr[title],
acronym[title],
dfn[title] {
text-decoration: dotted underline;
@simevidas
simevidas / App.js
Last active January 8, 2017 12:36
Autobound async class method (minimal example in Preact)
import { h, Component, render } from 'preact';
import autobind from 'autobind-decorator';
import 'normalize.css';
import 'App.scss';
import Header from 'Header';
class App extends Component {
@jpetazzo
jpetazzo / README.md
Last active August 21, 2019 17:55
Give network superpowers to docker

Unionize: network superpowers for your docker containers

Unionize lets you connect together docker containers in arbitrarily complex scenarios.

Note: I recommend to use https://github.com/jpetazzo/pipework instead.

  • pipework is a better name than unionize
  • it's hosted on a "real" github repo instead of a small gist :-)

Now if you want Unionize, it's still here. Just check those examples.

#!/usr/bin/bash
# Copyright (c) Joakim Reinert. All rights reserved.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
API_URL='https://api.domrobot.com/xmlrpc/'
TMPDIR='/tmp/inwx-acme'
@philipboomy
philipboomy / gist:b4f22c26cca62f0779714ac97ebe7cb2
Last active October 25, 2019 17:17
Laravel Mix 4 with Tailwind and Purge
const mix = require('laravel-mix');
const tailwindcss = require('tailwindcss');
require('laravel-mix-purgecss');
mix.setPublicPath('./web')
.postCss('src/css/main.css', 'css')
.options({
postCss: [tailwindcss('tailwind.config.js'), require('autoprefixer')],
processCssUrls: false,
})
@aFarkas
aFarkas / focus-within.js
Last active August 20, 2020 10:49
simple focus-within polyfill
(function(window, document){
'use strict';
var slice = [].slice;
var removeClass = function(elem){
elem.classList.remove('focus-within');
};
var update = (function(){
var running, last;
var action = function(){
var element = document.activeElement;
# set an env var to the path to a config
export REGTEST_CONFIG=$HOME/.config/hsd/regtest.conf
# this assumes you have git cloned and npm installed handshake
# be sure to start your handshake node with the same config
# ./bin/hsd --config=$REGTEST_CONFIG
# the cli tools live in node_modules/.bin
# also depends on jq