Skip to content

Instantly share code, notes, and snippets.

@aubuchcl
aubuchcl / gist:e4c2cab24101056a6db62bb8b75bc10b
Created October 1, 2021 21:36
Docker Linux GUI w VScode - browser
FROM dorowu/ubuntu-desktop-lxde-vnc:focal
WORKDIR /root/project
RUN apt update && \
apt install -y build-essential
RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg && \
install -o root -g root -m 644 packages.microsoft.gpg /usr/share/keyrings/ && \
sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list' && \
apt-get install apt-transport-https && \
@aubuchcl
aubuchcl / functions.php
Last active October 11, 2019 18:34
headless wp blender post type
add_action('init', function() {
register_post_type('blender', [
'public' => true,
'label' => 'Blenders',
'show_in_graphql' => true,
'graphql_single_name' => 'Blender',
'graphql_plural_name' => "Blenders"
]);
});
package capbuff
import (
"bytes"
"fmt"
"io"
"sync"
)
type Buffer struct {

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
def north_korean_cipher(coded_sentence)
input = coded_sentence.downcase.split("") # takes the input and splits each letter into its own string. Check out this method in IRB to see how it works! Also refer to the ruby docs.
decoded_sentence = [] #blank array
cipher = {"e" => "a", # This is technically a shift of four letters...Can you think of a way to automate this? Is a hash
"f" => "b", # the best data structure for this problem? What are the pros and cons of hashes?
"g" => "c",
"h" => "d",
"i" => "e",
"j" => "f",
"k" => "g",
// refactored code
// first set of functions received from Jake
// sum function worked upon receiving; did not modify
var sum = function(array){
var total = 0;
for(var index in array)
total += array[index];
return total;
}