Skip to content

Instantly share code, notes, and snippets.

@Cerdic
Cerdic / site-active-plugin.php
Last active December 18, 2015 21:38
Permet d'activer des plugins d'un site SPIP depuis la ligne de commande. Lancer le script depuis la racine du site ou depuis ecrire/ ou plugins/
#!/usr/bin/php
<?php
$activer = $argv;
array_shift($activer);
if (!is_dir('ecrire/') AND is_dir('../ecrire/')) chdir('../');
chdir('ecrire/');
if (!defined('_DIR_RESTREINT_ABS')) define('_DIR_RESTREINT_ABS', '');
@Cerdic
Cerdic / site-desactive-plugin.php
Last active December 18, 2015 21:38
Desactiver des plugins d'un site SPIP depuis la ligne de commande. Lancer le script depuis la racine du site SPIP, ou depuis le dossier ecrire/ ou le dossier plugins/
#!/usr/bin/php
<?php
$desactiver = $argv;
array_shift($desactiver);
if (!is_dir('ecrire/') AND is_dir('../ecrire/')) chdir('../');
chdir('ecrire/');
if (!defined('_DIR_RESTREINT_ABS')) define('_DIR_RESTREINT_ABS', '');
@apfelbox
apfelbox / Parser.php
Last active August 12, 2016 09:59
Adjusted parser to render paragraphs which only contain a single image without the paragraph. So instead <p><img ...></p> it just renders<img ...>
<?php
/**
* Adjusted parser to render paragraphs which only contain a single image without the paragraph.
*
* So instead
* <p><img ...></p>
*
* it just renders
* <img ...>
@lunelson
lunelson / post.md
Last active October 27, 2016 22:18
The Self-Aware Sass Mixin

I did a talk the other night at Up Front Berlin about some use cases for features in Sass from the past year. The slides are here; but I wanted to publish some notes so this post is one part of those notes.

My talk focused on the map data-type, and specifically on combining maps with directives such as @content, @at-root, and unique-id() in interesting ways. One of these is a mixin design pattern that solves some problems with using @extendand placeholder (silent) selectors in Sass:

  1. having placeholder extensions appear somewhere way up in the top of your code, because that's where you imported them; and
  2. having to think about choosing @include vs. @extend in the first place.

This "self-aware" mixin works by creating (and extending) a placeholder selector for itself dynamically, the first time it is included, and uses a map to keep records of these includes, so when it is subsequently in

// Photoshop Script to Create iPhone Icons from iTunesArtwork
// Original: https://gist.github.com/appsbynight/3681050
// Turn debugger on. 0 is off.
// $.level = 1;
try
{
// Prompt user to select iTunesArtwork file. Clicking "Cancel" returns null.
var iTunesArtwork = File.openDialog("Select a sqaure PNG file that is at least 1024x1024.", "*.png", false);
@brunob
brunob / cleanrss.html
Last active February 8, 2017 18:07
Un squelette SPIP qui prend l'url d'un flux RSS non valide en paramètre pour renvoyer le flux au propre. Pratique pour syndiquer certains flux WordPress (odgprod par exemple) dans Nextcoud. https://seenthis.net/messages/568088
#CACHE{0}
[(#HTTP_HEADER{Content-type: text/xml[; charset=(#CHARSET)]})]<?xml
version="1.0"[ encoding="(#CHARSET)"]?>
<rss version="2.0" [(#REM) rss 2.0.9)]
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
>
[(#SET{channel,#ENV{url}|analyser_site})]
<channel[ xml:lang="(#LANG)"]>
[<title>(#GET{channel}|table_valeur{nom_site}|textebrut|texte_backend)</title>]
@marcoleong
marcoleong / bootstrap-scrollspy-horizontal.js
Created February 27, 2012 09:22
Modified bootstrap-scrollspy.js to support horizontal scroll.
/* =============================================================
* bootstrap-scrollspy.js v2.0.1
* http://twitter.github.com/bootstrap/javascript.html#scrollspy
* =============================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@juanibrex
juanibrex / Pencil Project Hotkeys
Last active August 17, 2020 14:34
Pencil Project Shortcuts
# Pencil Project Shortcuts
## General Shortcuts
+ New Document: Ctrl + n
+ Open: Ctrl + o
+ Save: Ctrl + s
+ Save as: Ctrl + Shift + s
+ Export: Ctrl + Shift + e
+ Print: Ctrl + p
@robinnorth
robinnorth / wordpress_export-post-data.php
Created April 26, 2013 11:44
WordPress: Simple, configurable script to export post data to a CSV file
<?php
/**
* Export WordPress post data to CSV
* Based on <http://stackoverflow.com/a/3474698> and <http://ran.ge/2009/10/27/howto-create-stream-csv-php/>
*/
/**
*********************************************************************
* Configuration
*********************************************************************
@lee2sman
lee2sman / bash_cheatsheet.md
Last active June 23, 2022 16:35
bash scripting cheatsheet

Bash scripting cheatsheet

  • by Lee2sman
  • Updated 2017-09-18

Bash shebang

  • #!/usr/bin/env bash for portability, or less good, #!/bin/bash

Commenting