Quantcast
Channel: Recent Gists from devnix
Browsing latest articles
Browse All 15 View Live
↧

Gotham needs a hero...

batman.js var string = "abc"; var number = string++; number = number.toString(); var output = ''; var i = 0; while (i <= 16) { output = output + number; i++; } console.log(output + " Batman!");

View Article


Bootstrap 3 CSS media queries

media-queries.css /* Reference: http://goo.gl/6ise9j */ /* col-xs */ @media(max-width:767px) { } /* col-sm */ @media(min-width:768px) { } /* col-md */ @media(min-width:992px) { } /* col-lg */...

View Article


Wordpress 4.2.1 hotfix (put this file inside wp-includes)

README.md Wordpress 4.2.1 hotfix Overwrite your bad ol' wp-includes/formatting.php with this file to avoid that annoying PHP warning. If you prefer to fix it yourself instead downloading a 4.3k php...

View Article

Javascript strict mode

index.js (function() { 'use strict'; // Your code })();

View Article

Calculate difference in percentage between 2 hex colors. Port from Javascript...

colormeter.php <?php function color_meter($cwith, $ccolor) { if (empty($cwith) || empty($ccolor)) return false; $_cwith = ($cwith[0] === '#') ? substr($cwith, 1, 7) : $cwith; $_ccolor = ($ccolor[0]...

View Article


Render the Prestashop's blockcart module in Wordpress (or any external script)

prestashop-cart.php <?php // Prestashop's root folder, in my example Prestashop is installed in the root folder, and Wordpress is installed in /blog define('PRESTASHOP_ROOT', ABSPATH.'..'); //...

View Article

Snippet for easily using requestAnimationFrame with browser events

README.md Usage var OptimizedEvent = require('optimizedEvent'); var optimizedEvent = new OptimizedEvent(); optimizedEvent.add(function() { console.log('requestAnimationFrame\'d scroll :-D'); },...

View Article

CommonJS DOM-based Routing

app.js window.App = { common: require('./app/Common'), HomeController: require('./app/Controllers/HomeController'), }; var UTIL = { exec: function (controller, action) { var ns = App, // Change the...

View Article


Example of pagination with Twig

_pagination.html.twig {# Parameters: * total (int): number of pages * current (int): current pages * url (string): route name & query (string): route parameter ex: list/page-5?q=myFilter (5 = page...

View Article


Handling optional input parameters in PHP with `vimeo/psalm` and `azjezz/psl`

handling-optional-input-fields-with-type-safe-abstractions.mdHandling optional input parameters in PHP with vimeo/psalm and azjezz/pslI had an interesting use-case with a customer for which I provide...

View Article

Hexagonal container inspired by PHPStan source code

ContainerInterface.php This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden...

View Article

Make any PHP Exception serializable by flattening complex values in backtrace.

flattenExceptionBacktrace.php This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals...

View Article

keybase.md

keybase.mdKeybase proofI hereby claim:I am devnix on github.I am devnix (https://keybase.io/devnix) on keybase.I have a public key whose fingerprint is F533 CBB2 E009 31F8 DC9F CDB9 C366 D0EA 569E...

View Article

Browsing latest articles
Browse All 15 View Live