Skip to content

Instantly share code, notes, and snippets.

@davidfq
davidfq / toBase64
Created May 18, 2012
convert img to base64
View toBase64
echo -n "data:image/png;base64," > img.txt; base64 -w 0 img.png >> img.txt
View 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 / functions.php
Created May 8, 2019
Wordpress custom enqueue scripts and styles
View functions.php
/**
* @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 / react-tic-tac-toe.js
Last active Apr 7, 2020
React tutorial: tic-tac-toe game (last edit 2018-01-12)
View react-tic-tac-toe.js
// 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) {
You can’t perform that action at this time.