Skip to content

Instantly share code, notes, and snippets.

View orionstar's full-sized avatar

László Bóra orionstar

View GitHub Profile
@mikowl
mikowl / oneliners.js
Last active March 28, 2024 20:52
👑 Awesome one-liners you might find useful while coding.
// Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf
// Remove any duplicates from an array of primitives.
const unique = [...new Set(arr)]
// Sleep in async functions. Use: await sleep(2000).
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms)));
// or
const sleep = util.promisify(setTimeout);
@joseluisq
joseluisq / request_comment.mock.js
Created February 25, 2019 12:00
Rocket Chat and Bitbucket Server webhooks integration
// Mock Request Data (Pull Request Comment)
module.exports = {
url: {
hash: null,
search: null,
query: {},
pathname: '/hooks/2f7YhFx2f7YhFx2f7YhFx/hUPO&&)6@HqG_wY^B(2$MK_ivkEU1ix7MK_ivkEU1ix7',
path: '/hooks/2f7YhFx2f7YhFx2f7YhFx/hUPO&&)6@HqG_wY^B(2$MK_ivkEU1ix7MK_ivkEU1ix7'
},
url_raw: '/hooks/2f7YhFx2f7YhFx2f7YhFx/hUPO&&)6@HqG_wY^B(2$MK_ivkEU1ix7MK_ivkEU1ix7',
@yidas
yidas / codeiginter-server-config.md
Last active March 1, 2024 01:30
Codeigniter 3 server configuration for Nginx & Apache

Codeigniter 3 server configuration for Nginx & Apache

Web Server Site Configuration

Recommended Apache Configuration

Use the following configuration in Apache's httpd.conf file or within a virtual host configuration. Note that you should set DocumentRoot and ServerName fit to your environment:

@paulirish
paulirish / what-forces-layout.md
Last active June 18, 2024 12:00
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
@mauricesvay
mauricesvay / detector.js
Created January 9, 2014 10:23
Original js implementation of face detection
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
IMPORTANT
Please duplicate this radar for a Safari fix!
This will clean up a 50-line workaround.
rdar://22376037 (https://openradar.appspot.com/radar?id=4965070979203072)
//////////////////////////////////////////////////////////////////////////////
(Now available as a standalone repo.)
@intco
intco / ion_auth.sqlite.sql
Created September 2, 2013 06:28
SQL dump of CodeIgniter ion-auth extension for SQLITE database
DROP TABLE IF EXISTS `groups`;
--
-- Table structure for table 'groups'
--
CREATE TABLE `groups` (
`id` integer NOT NULL,
`name` varchar(20) NOT NULL,
`description` varchar(100) NOT NULL,
@sardbaba
sardbaba / wordpress-function.php
Last active December 14, 2015 18:29
qtrans_generate_language_list() is a better version of the qtrans_generateLanguageSelectCode() function from qTranslate's Wordpress plugin, originally used to print the languages as an HTML select. This function receive an optional string for the separator that will be echoed and it is able to show your languages as spans followed by separators:…
/**
* Language list Code for non-Widget users
*
* @global array $q_config
* @param string $sep
*/
function qtrans_generate_language_list($sep = " | ") {
global $q_config;
$languages = qtrans_getSortedLanguages();
$num_langs = count($languages);
@lancejpollard
lancejpollard / meta-tags.md
Created March 5, 2012 13:54
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@pamelafox
pamelafox / senderror.js
Created February 21, 2012 19:20
Sending JS errors to server
function sendError(message, url, lineNum) {
var i;
// First check the URL and line number of the error
url = url || window.location.href;
lineNum = lineNum || 'None';
// If the error is from these 3rd party script URLs, we ignore
// We could also just ignore errors from all scripts that aren't our own
var scriptURLs = [