Skip to content

Instantly share code, notes, and snippets.

View thefonso's full-sized avatar

thefonso thefonso

View GitHub Profile
@thefonso
thefonso / vpn.md
Created September 22, 2023 22:39 — forked from joepie91/vpn.md
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.

Configuring Emacs for react, es6, and flow

For a while, JSX and new es6 syntax had flaky support in emacs, but there's been huge work on a lot of packages. Using emacs for JavaScript with React, ES6, and Flow (or Typescript, etc) is really easy and powerful in Emacs these days.

This is how you can work on modern web development projects with full support for tooling like JSX, Flow types, live eslint errors, automatic prettier.js formatting, and more.

Set up web-mode

web-mode provides most of the underlying functionality, so a huge shout-out to the maintainer(s) there.

GraphQL Queries & Mutations

These are the GraphQL queries and mutations for the YouTube course.

Get names of all clients

{
  clients {
    name
 }
@thefonso
thefonso / spacemacs-cheatsheet.md
Created August 14, 2022 01:42 — forked from heroheman/spacemacs-cheatsheet.md
Spacemacs Cheatsheet - A cheat sheet for my most common shortcuts in Spacemacs

General

Shortcut Description
SPC f e d Open Configuration
SPC f e R Reload Configuration
SPC SPC Search Emacs
SPC h SPC Search Spacemacs Layer
SPC f s Save Buffer
SPC q q Quit Emacs w/ Prompt
SPC q Q Quit Emacs w/o Prompt
@thefonso
thefonso / install_ruby_with_rbenv.md
Created March 18, 2020 16:37 — forked from stonehippo/install_ruby_with_rbenv.md
Installing a new Ruby with rbenv on Mac OS

Install a new Ruby with rbenv on Mac OS (and make yourself a superhero)

If you're doing stuff with Ruby on a Mac, e.g. installling Jekyll or something, by default you'll end up having to use the sudo command to do stuff, since the permission to modify the default config is not available to your user account.

This sucks and should be avoided. Here's how to fix that.

Installing a new Ruby

To make this better, we are going install a new, custom Ruby. This used to be a big, scary thing, but thanks to the awesome tools Homebrew and rbenv, it's a snap.*

A word of warning: you will have to use Terminal to install this stuff. If you are uncomfortable with text, words, and doing stuff with your computer beyond pointing and hoping, this may not work well for you. But if that's the case, I'm not sure why you were trying to use Ruby in the first place.

@thefonso
thefonso / postgresql_mac.md
Created July 2, 2019 05:06
Getting Started with PostgreSQL on Mac OS X

PostgreSQL on Mac OS X

Install, and verify the installation.

$ brew install postgresql
$ postgres —help
postgres is the PostgreSQL server.
...
$ psql --help

psql is the PostgreSQL interactive terminal.

@thefonso
thefonso / squeeze.dockerfile
Created July 2, 2019 03:26 — forked from ricsiga/squeeze.dockerfile
Debian Squeeze Dockerfile example
FROM debian:squeeze
RUN echo "deb http://archive.debian.org/debian squeeze main" > /etc/apt/sources.list
RUN echo "deb http://archive.debian.org/debian squeeze-lts main" >> /etc/apt/sources.list
RUN echo "Acquire::Check-Valid-Until false;" > /etc/apt/apt.conf
RUN apt-get update
RUN apt-get install -y procps vim nano tmux curl
CMD ["/bin/bash"]
@thefonso
thefonso / global-gitignore.md
Created January 12, 2019 23:56 — forked from subfuzion/global-gitignore.md
Global gitignore

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file. Create a file called .gitignore in your home directory and add anything you want to ignore. You then need to tell git where your global gitignore file is.

Mac

git config --global core.excludesfile ~/.gitignore

Windows

git config --global core.excludesfile %USERPROFILE%\.gitignore
@thefonso
thefonso / restart_bluetooth.sh
Created January 7, 2019 21:58 — forked from nicolasembleton/restart_bluetooth.sh
Restart Bluetooth Daemon on Mac OS X without restarting
#!/bin/bash
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
@thefonso
thefonso / findNumber.js
Created October 22, 2018 02:52 — forked from dre4success/cloudSettings
Given an unsorted array of n elements, find if the element k is present in the given array or not. return 'YES' or 'NO'
function findNumber(arr, k) {
let result = 'NO';
arr.forEach(item => {
if(k === item) {
return result = 'YES';
}
})
return result;
}