Skip to content

Instantly share code, notes, and snippets.

View timonweb's full-sized avatar

Tim Kamanin timonweb

View GitHub Profile
#!/bin/bash
# James Shubin, 2018
# run `make` in the first directory (or its parent recursively) that it works in
# https://purpleidea.com/blog/2018/03/10/running-make-from-anywhere/
MF='Makefile' # looks for this file, could look for others, but that's silly
CWD=$(pwd) # starting here
while true; do
if [ -e "$MF" ]; then
const fs = require("fs");
const pathClient = "./node_modules/react-dev-utils/webpackHotDevClient.js";
fs.writeFileSync(
pathClient,
fs
.readFileSync(pathClient)
.toString()
.replace(
@timonweb
timonweb / swiper-magnific-popup.js
Created September 27, 2018 12:01 — forked from thiagoeliasr/swiper-magnific-popup.js
Adding swipe support to Magnific Popup galleries. (touchSwipe is required: http://labs.rampinteractive.co.uk/touchSwipe/demos/)
(function() {
/* Define a variável que dá swipe no lightbox */
var magnificPopup = $.magnificPopup.instance;
/* Carrega a função quando clica no lightbox (senão não pega a classe utilizada) */
$("a.image-lightbox").click(function(e) {
/* Espera carregar o lightbox */
setTimeout(function() {
/* Swipe para a esquerda - Próximo */
@timonweb
timonweb / inline_panel.js
Created August 21, 2018 10:52 — forked from unexceptable/inline_panel.js
OneToOne Wagtail InlinePanel
// stuff/templates/wagtailadmin/edit_handlers/inline_panel.js
(function() {
var opts = {
formsetPrefix: "id_{{ self.formset.prefix }}",
emptyChildFormPrefix: "{{ self.empty_child.form.prefix }}",
canOrder: {% if can_order %}true{% else %}false{% endif %},
maxForms: {{ self.formset.max_num }}
};
var panel = InlinePanel(opts);
@timonweb
timonweb / final_models.py
Last active March 9, 2018 16:14 — forked from lb-/final_models.py
Django + Wagtail - custom taxonomy model. Code for tutorial here: https://posts-by.lb.ee/building-a-configurable-taxonomy-in-wagtail-django-94ca1080fb28
"""Node model and Node admin interaction."""
from django import forms
from django.conf.urls import url
from django.contrib.admin.utils import quote, unquote
from django.core.exceptions import PermissionDenied
from django.core.validators import MinLengthValidator, RegexValidator
from django.db import models
from django.shortcuts import get_object_or_404
from django.template.loader import render_to_string
@timonweb
timonweb / basic-webpack-config.js
Created May 23, 2017 07:48
A basic ES2015 Webpack Configuration with Uglification
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
entry: './src/main.js',
output: {
path: './dist/',
filename: 'bundle.js'
},
module: {
@timonweb
timonweb / headless-chromium-mac.md
Created November 26, 2016 19:49 — forked from corysimmons/headless-chromium-mac.md
Instructions for how to build Headless Chromium on Mac.

Doesn't work yet.

Build

  • brew install ninja
  • mkdir -p ~/chromium
  • cd ~/chromium
  • git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
  • export $PATH=$PWD/depot_tools:$PATH (shell specific)
  • fetch --no-history chromium --nosvn=True
@timonweb
timonweb / __INDEX.txt
Created July 6, 2016 13:05 — forked from facine/__INDEX.txt
Drupal 8 - Examples
# Taxonomy terms:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_taxonomy_term-php
# Menu links:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_menu_link-php
# File items:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_file-php
# Nodes:
@timonweb
timonweb / git-branches-by-commit-date.sh
Created December 9, 2015 09:35 — forked from jasonrudolph/git-branches-by-commit-date.sh
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
@timonweb
timonweb / responsive-modal.css
Last active September 11, 2015 14:05 — forked from jameswilson/responsive-modal.css
Drupal Ctools Responsive Modal
/* Override inline dom styles from modal.js */
#modalContent {
position: fixed !important;
top: 12% !important;
bottom: 12% !important;
right: 4% !important;
left: 4% !important;
}
/* Limit max width to 1000px */
div.ctools-modal-content {