Skip to content

Instantly share code, notes, and snippets.

View itsgreggreg's full-sized avatar
🍹
chillin

Greg Baraghimian itsgreggreg

🍹
chillin
View GitHub Profile
-module(bench_inline_type).
-export([non_inline_worst_case/1,
bench_non_inline_worst_case/2,
inline_worst_case/1,
bench_inline_worst_case/2,
non_inline_function_head_match/1,
bench_non_inline_function_head_match/2,
inline_function_head_match/1,
bench_inline_function_head_match/2,
@itsgreggreg
itsgreggreg / tcp_client_is_you.rs
Created March 29, 2020 19:57
Rust TCP client where you are the client
//! A simple TCP client where you are the client
//! An authority must be supplied, ie: cargo run -- pop.dreamhost.com:110
//!
//! Reads from and writes to stdio
//! Does nothing special with the incoming stream, simply prints 8bit chars.
//! Removes new lines from outbound stream, appends CR/LF.
use std::io::{stdin, stdout, Read, Write};
use std::net::TcpStream;
fn main() {
2017-11-07 07:46:19 -0700
make
install
PREFIX=/usr/local/Cellar/kakoune/HEAD-d6b5240
clang++ -DKAK_DEBUG -I/usr/local/Cellar/kakoune/HEAD-d6b5240/opt/ncurses/include -I/opt/local/include -pedantic -std=gnu++14 -g -Wall -Wextra -Wno-unused-parameter -Wno-reorder -Wno-sign-compare -Wno-address -Wno-noexcept-type -Wno-unknown-attributes -Wno-unknown-warning-option -MD -MP -MF .alias_registry.debug.d -c -o .alias_registry.debug.o alias_registry.cc
clang++ -DKAK_DEBUG -I/usr/local/Cellar/kakoune/HEAD-d6b5240/opt/ncurses/include -I/opt/local/include -pedantic -std=gnu++14 -g -Wall -Wextra -Wno-unused-parameter -Wno-reorder -Wno-sign-compare -Wno-address -Wno-noexcept-type -Wno-unknown-attributes -Wno-unknown-warning-option -MD -MP -MF .assert.debug.d -c -o .assert.debug.o assert.cc
clang++ -DKAK_DEBUG -I/usr/local/Cellar/kakoune/HEAD-d6b5240/opt/ncurses/include -I/opt/local/include -pedantic -std=gnu++14 -g -Wall -Wextra -Wno-unused-parameter -Wno-reorder -Wno-sign-compare -Wno-address -Wno-noexcept-type -Wno-unk
@itsgreggreg
itsgreggreg / webcam.html
Last active October 6, 2017 21:41
Quick and dirty webcam in browser
<video id="video" width="640" height="480" autoplay></video>
<button id="snap">Snap Photo</button>
<canvas id="canvas" width="640" height="480"></canvas>
<script>
// Grab elements, create settings, etc.
var video = document.getElementById('video');
// Get access to the camera!

Keybase proof

I hereby claim:

  • I am itsgreggreg on github.
  • I am greggreg (https://keybase.io/greggreg) on keybase.
  • I have a public key whose fingerprint is EEE7 1FC8 7328 62C1 7482 5689 8749 2ABC 1645 F5B7

To claim this, I am signing this object:

@itsgreggreg
itsgreggreg / elixir_debugging.md
Last active June 28, 2017 11:56
Elixir Debugging
@itsgreggreg
itsgreggreg / 15-minutes-to-prototypal-inheritance.md
Last active May 26, 2016 20:12
15 minutes to Prototypal Inheritance

Prototypal Inheritance

Goals

By the end of this lesson students should be able to:

  • Demonstrate a use case that explains prototypal inheritance
  • Demonstrate what kind of flexibility prototypal inheritance gives programmers

Summary

In this lesson we are going to learn about a type of inheritance called Prototypal Inheritance. We are going to see how with prototypes we can share functionality between related objects. We are going to see how with Object.create we can easily set up prototypes and how we can extend prototypes to easily add functionality.

@itsgreggreg
itsgreggreg / instachat.md
Last active April 8, 2016 19:33
Phoenix Intsachat

Instachat

The Phoenix Framework was built with realtime communication as a first class priority. Using its built in socket handling and channels we can implement a basic, realtime chat application with little effort.

For this video we’re going to assume that you already have Elixir and Phoenix Setup. You will not need a database as the messages will not be persisted. This tutorial is taken pretty much directly from the Phoenix Documentation.

Setting up the app

To start let’s generate a standard phoenix application:

$> mix phoenix.new instachat
  • MAMP: https://www.mamp.info/en/downloads/
  • Craft CMS: https://craftcms.com/pricing
  • Open up MAMP
    • Preferences -> Web Server
      • Change Document Root to public folder in Craft CMS download
    • Start Servers
  • If it doesn't open automatically hit "open WebStart page"
  • tools -> phpMyAdmin
    • top left "new" button
  • database name: project_name
@itsgreggreg
itsgreggreg / counter-full.elm
Last active February 19, 2016 16:20
Elm FEP Talk
module Main where
import Html exposing (div,button,Html,text,Attribute)
import Html.Events exposing(onClick)
import Html.Attributes exposing (style)
import StartApp.Simple exposing (start)
type alias Model = Int
type Action = Increment | Decrement