Skip to content

Instantly share code, notes, and snippets.

View avesus's full-sized avatar
🎯
Focusing

Brian Cannard avesus

🎯
Focusing
View GitHub Profile
#include <IOKit/IOTypes.h>
#include <IOKit/IOKitLib.h>
#include <CoreSurface/CoreSurface.h>
#include <stdio.h> // For mprotect
#include <sys/mman.h>
#ifdef __cplusplus
extern "C" {
#endif
@umidjons
umidjons / sort-object-properties-by-value.md
Last active October 9, 2024 10:31
JavaScript: sort object properties by value (numeric or string)

Sort object properties by value (values are text)

I have following object:

var cities={10:'Tashkent', 14:'Karakalpakiya', 16:'Andijan'};

I want sort it by city names, so after sort it should be:

var cities={16:'Andijan', 14:'Karakalpakiya', 10:'Tashkent'};

But I can't sort object properties, instead can convert object into array, then sort items.

@Hoff97
Hoff97 / JSONE.js
Last active September 24, 2020 03:54
Special JSON object that is able to convert Objects with their methods and also converts cyclic objects.
//Erweiterte JSON, die auch spezielle Objekte parst und zu JSON umwandelt:
//Objekte, die sich selbst enthalten
//Objekte, die Funktionen enthalten
var JSONE = {};
JSONE.to = {};
JSONE.to.removeCycle = function(obj,already = [],lvl = 1,path="PATH#obj"){
if(typeof obj === "object")
{
for(var i in already)
{
@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active December 9, 2025 06:56
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@staltz
staltz / introrx.md
Last active December 1, 2025 11:31
The introduction to Reactive Programming you've been missing
@danielstjules
danielstjules / sockjs_ws.patch
Created June 30, 2014 15:39
Patch to use ws with sockjs-node rather than faye-websocket-node
From ae279bfe194b1b17a6dc18e0720e61d253414154 Mon Sep 17 00:00:00 2001
From: "Daniel St. Jules" <[email protected]>
Date: Thu, 8 May 2014 18:59:20 -0400
Subject: [PATCH] Replace faye-websocket-node with ws
---
package.json | 4 ++--
src/trans-websocket.coffee | 15 +++++++--------
2 files changed, 9 insertions(+), 10 deletions(-)
@hectorperez
hectorperez / copy word under cursor in Vim.txt
Created August 7, 2014 13:37
copy word under cursor in Vim
copy/delete word under cursor in Vim
yw / byw
Assuming that the cursor is at the first character of the word simply do this in command mode:
yw
y is for yank and w is for word.
Other ways of doing the same thing which are not as efficient:
vey
the v starts visual select mode. e tells vim to move to end of word. y yanks or copies the word. to delete replace y with x.
@pburtchaell
pburtchaell / styles.css
Last active February 12, 2025 08:45
VH and VW units can cause issues on iOS devices. To overcome this, create media queries that target the width, height, and orientation of iOS devices.
/**
* VH and VW units can cause issues on iOS devices: http://caniuse.com/#feat=viewport-units
*
* To overcome this, create media queries that target the width, height, and orientation of iOS devices.
* It isn't optimal, but there is really no other way to solve the problem. In this example, I am fixing
* the height of element `.foo` —which is a full width and height cover image.
*
* iOS Resolution Quick Reference: http://www.iosres.com/
*/
@avesus
avesus / gist:394fea04b34471fdf23d
Last active October 28, 2023 23:24
Unix style
program > file # write program stdout to file
program1 | program2 # send stdout of program1 to stdin of program2
program < file # write file to program stdin
program1 && program2 # exec program2 only if program1 returns 0
program1; program2 # exec program2 ever if program1 failed
cmd1; cmd2; cmd3 & - will only execute cmd3 in the background
cmd1 && cmd2 && cmd3 & - will execute the entire chain in the background IF there are no errors.
To cater for unconditional execution, using parenthesis solves this :
@mbbx6spp
mbbx6spp / README.md
Last active September 26, 2025 13:22
Gerrit vs Github for code review and codebase management

Gerrit vs Github: for code review and codebase management

Sure, Github wins on the UI. Hands down. But, despite my initial annoyance with Gerrit when I first started using it almost a year ago, I am now a convert. Fully. Let me tell you why.

Note: This is an opinionated (on purpose) piece. I assume your preferences are like mine on certain ideas, such as:

  • Fast-forward submits to the target branch are better than allowing merge commits to the target branch. The reason I personally prefer this is that, even if a non-conflicting merge to the target branch is possible, the fact that the review/pull request is not up to date with the latest on the target branch means feature branch test suite runs in the CI pipeline reporting on the review/PR may not be accurate. Another minor point is that forced merge commits are annoying as fuck (opinion) and clutter up Git log histories unnecessarily and I prefer clean histories.
  • Atomic/related changes all in one commit is something worth striving for. Having your dev