Skip to content

Instantly share code, notes, and snippets.

View timonweb's full-sized avatar

Tim Kamanin timonweb

View GitHub Profile
@gaearon
gaearon / index.html
Last active February 13, 2024 09:46
Multiple React components on a single HTML page
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Add React in One Minute</title>
</head>
<body>
<h2>Add React in One Minute</h2>
<p>This page demonstrates using React with no build tooling.</p>
#!/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
@lb-
lb- / final_models.py
Last active March 28, 2023 17:20
Django + Wagtail - custom taxonomy model
"""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
@unexceptable
unexceptable / inline_panel.js
Created May 30, 2017 07:08
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 / 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
@jacurtis
jacurtis / _spacing-helpers.scss
Last active May 30, 2024 17:41
SASS Margin and Padding Helpers Loop. Generates .m-t-10 type helper classes.
/*
This .scss loop will create "margin helpers" and "padding helpers" for use in your web projects.
It will generate several classes such as:
.m-r-10 which gives margin-right 10 pixels.
.m-r-15 gives MARGIN to the RIGHT 15 pixels.
.m-t-15 gives MARGIN to the TOP 15 pixels and so on.
.p-b-5 gives PADDING to the BOTTOM of 5 pixels
.p-l-40 gives PADDING to the LEFT of 40 pixels
@thiagoeliasr
thiagoeliasr / swiper-magnific-popup.js
Created August 13, 2015 13:27
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 */
INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)
@jameswilson
jameswilson / responsive-modal.css
Last active March 5, 2021 19:59
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 {
@TheDistantSea
TheDistantSea / version_compare.js
Created December 18, 2013 12:19
Function to compare two version strings (e.g. "1.6.1" is smaller than "1.7"). Developed in order to answer http://stackoverflow.com/a/6832721/50079.
/**
* Compares two software version numbers (e.g. "1.7.1" or "1.2b").
*
* This function was born in http://stackoverflow.com/a/6832721.
*
* @param {string} v1 The first version to be compared.
* @param {string} v2 The second version to be compared.
* @param {object} [options] Optional flags that affect comparison behavior:
* <ul>
* <li>