Skip to content

Instantly share code, notes, and snippets.

@davidfq
davidfq / react-tic-tac-toe.js
Last active April 7, 2020 07:00
React tutorial: tic-tac-toe game (last edit 2018-01-12)
// React tutorial: tic-tac-toe game
// https://reactjs.org/tutorial/tutorial.html
// https://davidfq.me/blog/react-first-steps/
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
function Square(props) {
@davidfq
davidfq / functions.php
Created May 8, 2019 13:24
Wordpress custom enqueue scripts and styles
/**
* @custom:mytheme
* Enqueue scripts and styles. Different paths depending on `SCRIPT_DEBUG` value,
* first resource found is used: this allows using file names including hashes
* (webpack style) to avoid chaching, i.e. `main.[hash].css`
* https://codex.wordpress.org/Debugging_in_WordPress
*/
function mytheme_scripts() {
$assetsDir = (SCRIPT_DEBUG == true ? '/dev' : '/dist');
$dir = new DirectoryIterator(get_stylesheet_directory() . $assetsDir);
@davidfq
davidfq / jqplugin.js
Last active December 23, 2015 20:29 — forked from hernan/jqplugin.js
// jQuery Plugin Boilerplate
// A boilerplate for jumpstarting jQuery plugins development
// version 1.1, May 14th, 2011
// by Stefan Gabos
// http://stefangabos.ro/jquery/jquery-plugin-boilerplate-revisited/#requirements
// remember to change every instance of "pluginName" to the name of your plugin!
(function($) {
// here we go!
@davidfq
davidfq / toBase64
Created May 18, 2012 09:45
convert img to base64
echo -n "data:image/png;base64," > img.txt; base64 -w 0 img.png >> img.txt