Skip to content

Instantly share code, notes, and snippets.

View anova's full-sized avatar

Necat Bolpaça anova

View GitHub Profile
@bradtraversy
bradtraversy / tailwind-webpack-setup.md
Last active May 10, 2024 23:13
Setup Webpack with Tailwind CSS

Webpack & Tailwind CSS Setup

Create your package.json

npm init -y

Create your src folder

Create a folder called src and add an empty index.js file. The code that webpack compiles goes in here including any Javascript modules and the main Tailwind file.

@gkmngrgn
gkmngrgn / en_tr_layout.ahk
Last active October 22, 2021 16:16
An AutoHotkey script for using Turkish special letters in US keyboard layout
>!a::Send {U+00E2}
>!c::Send {U+00E7}
>!g::Send {U+011F}
>!i::Send {U+0131}
>!o::Send {U+00F6}
>!s::Send {U+015F}
>!u::Send {U+00FC}
>!+a::Send {U+00C2}
>!+c::Send {U+00C7}
>!+g::Send {U+011E}
@sindresorhus
sindresorhus / esm-package.md
Last active May 8, 2024 22:50
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@LeaVerou
LeaVerou / 1-simple.js
Last active November 23, 2020 09:34
Insert a property before another object literal property, while maintaining all references to that object
function insert(obj, {before, property, value}) {
let found, temp = {};
// Delete all properties from before onwoards and save them in temp
for (let p in obj) {
if (p === before) {
found = true;
}
if (found) {
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var elements = document.body.getElementsByTagName('*');
var items = [];
for (var i = 0; i < elements.length; i++) {
if (elements[i].innerHTML.indexOf('* { background:#000!important;color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }') != -1) {
items.push(elements[i]);
}
}
@zekeriyaguzelsoy
zekeriyaguzelsoy / Not working on Bootstrap's modal or tab
Created March 22, 2019 12:46
Bs modal ya da tab içerisinde slider kullanımı hakkında
Bu sorun ile karşılaştığımda sorunun benden kaynaklandığını düşünüp tekrar ve tekrar yazarak yanlış olan kısmı çözmeye çalışmıştım ama
nafile idi :( Bu sorunu yaşayan bir çok kişi varmış meğersem.
Yapmaya çalıştığım şey;
Bs nav-tabs kullanarak her bir kategoriye tıkladığımızda aktif olan kategorinin içerisinde slider olacak
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<a class="nav-item nav-link active" id="nav-home-tab" data-toggle="tab" href="#nav-home" role="tab" aria-controls="nav-home" aria-selected="true">Kategori 1</a>
@westonruter
westonruter / wp-42573.php
Last active September 21, 2023 13:41
WP Trac #42573: Fix for theme template caching. https://core.trac.wordpress.org/ticket/42573
<?php
/**
* Plugin name: WP Trac #42573: Fix for theme template file caching.
* Description: Flush the theme file cache each time the admin screens are loaded which uses the file list.
* Plugin URI: https://core.trac.wordpress.org/ticket/42573
* Author: Weston Ruter, XWP.
* Author URI: https://weston.ruter.net
*/
function wp_42573_fix_template_caching( WP_Screen $current_screen ) {
@sayhicoelho
sayhicoelho / replace_between.php
Created June 22, 2017 00:47
Replace string between
<?php
function replace_between($str, $needle_start, $needle_end, $replacement = '')
{
return preg_replace('/' . $needle_start . '.+?' . $needle_end . '/sm', $replacement, $str);
}

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@paulirish
paulirish / what-forces-layout.md
Last active May 11, 2024 00:41
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent