Skip to content

Instantly share code, notes, and snippets.

View nilportugues's full-sized avatar

Nil Portugués Calderó nilportugues

View GitHub Profile
@danecando
danecando / tailwind-color-vars.js
Created September 5, 2022 13:09
A simple plugin that exposes all tailwind colors as css variables on :root
function ({ addBase, theme }) {
function extractColorVars(colorObj, colorGroup = '') {
return Object.keys(colorObj).reduce((vars, colorKey) => {
const value = colorObj[colorKey];
const newVars =
typeof value === 'string'
? { [`--color${colorGroup}-${colorKey}`]: value }
: extractColorVars(value, `-${colorKey}`);
@smoya
smoya / README.md
Last active May 8, 2017 16:41
Get php trace -on segmentation fault- using xdebug
  • Enable the tracer on your xdebug.ini file (see the xdebug.ini file).
  • If you are gonna trace an http request, make sure your xdebug.trace_output_dir is writable by the webserver user (www-data).
  • Execute your script or your request. You can use produce_segmentation.php to test.
  • See the trace file(s) on your xdebug.trace_output_dir.
@dylanfries
dylanfries / Events & Delegates in Unity C#
Last active November 2, 2023 21:42
Events and Delegates for Unity (C#)
Events & Delegates
------------------
Events and Delegates were something I struggled with when I was first learning how they worked. Once I figured it out it became one of the most useful and powerful techniques for games. Its especially useful for helping to decouple classes while allowing for messaging.
Delegates - Simply a container for a function that can be used as a variable.
Events - Allows you to specify a delegate that gets called when some event in your code is triggered.
Overview
@fideloper
fideloper / CodeTest.php
Created November 11, 2013 13:55
Example testing with in-memory SQLite database
<?php
/**
* Intention:
*
* "testing" environment has a SQLite database configured
* Run migrations against --env=testing
*
* Separate seeds run here per test method will delete the SQLite
* code tables, and re-create them with codes that fit the needs
@esperlu
esperlu / mysql2sqlite.sh
Created April 27, 2011 05:46
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite