Skip to content

Instantly share code, notes, and snippets.

View nonsocode's full-sized avatar
🖖
I want it so i get it

Chinonso Chukwuogor nonsocode

🖖
I want it so i get it
View GitHub Profile
@manix
manix / sample.js
Last active March 1, 2024 23:51
Improved "fieldSorter"
function fieldSorterOptimized(fields) {
var dir = [], i, l = fields.length;
fields = fields.map(function(o, i) {
if (o[0] === "-") {
dir[i] = -1;
o = o.substring(1);
} else {
dir[i] = 1;
}
return o;
@arbourd
arbourd / invert.md
Created May 9, 2017 23:12
Invert Windows 10 mouse scroll wheel
  1. Open Powershell as an administrator
  2. Run
    Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 0 | ForEach-Object { Set-ItemProperty $_.PSPath FlipFlopWheel 1 }
  3. Verify that all mice devices have had their FlipFlopWheel attributes set to 1
    Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 0
  4. Reboot
@morrisonlevi
morrisonlevi / Why ES6 arrow functions won't work in PHP.md
Last active February 2, 2018 09:19
Using the syntax for ES6 arrow functions wouldn't work in PHP. Here's why and how we could work around it.

In EcmaScript 2015 (ES6) the expression (x) => x * 2 means to create an anonymous function with one parameter x that will return x * 2. For example:

(x) => x * 2
// is equivalent to:
function(x) { return x * 2; }

A modified example from [documentation by Mozilla Developer Network][1] page demonstrates how they are useful:

var a = [

"Hydrogen",