Skip to content

Instantly share code, notes, and snippets.

View compile_commands.json
[
{
"directory": "/Users/peter/build_fish",
"command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -DBINDIR=L\\\"/usr/local/bin\\\" -DCMAKE_BINARY_DIR=\\\"/Users/peter/build_fish\\\" -DCMAKE_SOURCE_DIR=\\\"/Users/peter/github/fish-shell\\\" -DDATADIR=L\\\"/usr/local/share\\\" -DDOCDIR=L\\\"/usr/local/share/doc/fish\\\" -DLOCALEDIR=\\\"/usr/local/share/locale\\\" -DPREFIX=L\\\"/usr/local\\\" -DSYSCONFDIR=L\\\"/usr/local/etc\\\" -D_REENTRANT -D_UNICODE=1 -I. -I/usr/local/include -fdiagnostics-color=always -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -fno-exceptions -o CMakeFiles/fish_macapp.dir/osx/osx_fish_launcher.m.o -c /Users/peter/github/fish-shell/osx/osx_fish_launcher.m",
"file": "/Users/peter/github/fish-shell/osx/osx_fish_launcher.m"
},
{
"directory": "/Users/peter/build_fish",
"command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/b
View c_cpp_properties.json
{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**",
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include",
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1"
],
"defines": [],
View gist:652f6fb05e03bc76e110c4adc1d9ecc7
complete(1) fish complete(1)
NNAAMMEE
complete
ccoommpplleettee -- eeddiitt ccoommmmaanndd ssppeecciiffiicc ttaabb--ccoommpplleettiioonnss
SSyynnooppssiiss
ccoommpplleettee ( -c | --command | -p | --path ) COMMAND
View charlist.cpp
#include <memory>
#include <string>
struct CharList {
char c;
std::unique_ptr<CharList> next;
explicit CharList(char c) : c(c) {}
};
CharList make_list(const std::string &s) {
View gist:740ac4891b2d442aba9d91bdeb027d4c
#!/usr/bin/env sh
# Originally from the git sources (GIT-VERSION-GEN)
# Presumably (C) Junio C Hamano <junkio@cox.net>
# Reused under GPL v2.0
# Modified for fish by David Adam <zanchey@ucc.gu.uwa.edu.au>
set -e
# Find the fish git directory as two levels up from script directory.
GIT_DIR="$( cd "$( dirname $( dirname "$0" ) )" && pwd )"
View burn.cpp
#include <string>
#include <sys/types.h>
#include <pwd.h>
#include <uuid/uuid.h>
#include <vector>
#include <thread>
static size_t burn() {
size_t ret = 0;
setpwent();
@ridiculousfish
ridiculousfish / width.c
Created Jun 23, 2018
wcwidth of variation selector
View width.c
#include <wchar.h>
#include <stdio.h>
#include <locale.h>
int main(void) {
char *loc = setlocale(LC_ALL, "");
printf("%s %d\n", loc, wcwidth(0xFE0F));
return 0;
}
View g++ vs clang
#include <stdio.h>
#include <functional>
void func(std::function<void(void)> func) {
printf("func1\n");
}
template<typename ANYTHING>
static void foo() {
func([](){});
View fish_iwyu.patch
diff --git a/autoload.cpp b/autoload.cpp
index c883f8b..12ae9db 100644
--- a/autoload.cpp
+++ b/autoload.cpp
@@ -3,15 +3,23 @@
The classes responsible for autoloading functions and completions.
*/
-#include "config.h"
#include "autoload.h"
View sort vs sort
// c++ -std=c++11 -O3 sort.cpp ; ./a.out
// qsort: 674 ms
// std::sort: 1104 ms
#include <string.h>
#include <stdio.h>
#include <chrono>
#include <string>
#include <vector>
#include <iostream>
You can’t perform that action at this time.