Skip to content

Instantly share code, notes, and snippets.

View yeti-detective's full-sized avatar

Chris B yeti-detective

View GitHub Profile
@yeti-detective
yeti-detective / async-poc.go
Created February 2, 2021 21:29
Proof of Concept for using goroutine and channel to accomplish async functionality
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
// create a single channel of size 1
@yeti-detective
yeti-detective / gifit.sh
Last active July 22, 2021 15:59
This function will let you make MacOs screen captures into .gif files by running `gifit <input_filename> <gif pixel size ie: 1200x800> <output_filename>`
function gifit {
gifthis=1
input_file=""
output_file=output.gif
gifsize=900x600
if [[ $# -eq 0 ]]; then
gifthis=0
echo "Usage: gifit <input_mov_file> <gif pixel size ie: 1200x800> <output_gif_filename>"
echo " converts mov files into <gif_size> gif files"
fi
@yeti-detective
yeti-detective / buildSearchPool.js
Created September 27, 2018 19:26
Method of a React web component that displays search results
// this is one method of a component from my SoundClone app
buildSearchPool () {
if (this.state.query === '') {
this.setState({
searchPool: []
})
} else {
const pool = [];
Object.keys(this.props.songs).filter((songId) => {
var path = require('path'); // You know what path is for
var webpack = require('webpack'); // obviously it needs webpack
module.exports = {
/*
the entry key defines the file that will be the entry point. In our case, index.jsx
*/
  entry: path.join(__dirname + '/index.jsx'),
/*
the output key names the file and location of the transpiled javascript
import React from 'react';
var nurse = "world";
class MyApp extends React.Component {
render(){
return (
<div className="hi-there">
<h2>Hellooooooooo, {nurse}</h2>
</div>
);
import React from 'react';
import {render} from 'react-dom';
import MyApp from './MyApp';
class App extends React.Component {
render() {
return (
<MyApp />
);
<html> <!-- fun fact: you don't have to declare DOCTYPE for HTML5. So stop it. -->
<head>
<title>React4Beginners</title>
</head>
<body>
<h1>Hey, oh boy! Hi there, World!</h1>
</body>
</html>
const express = require('express'); // this is just so easy. Read up on it later
const app = express(); // now 'app' is an express application
const path = require('path'); // this will help you tell Node where your files are
// when the app 'gets' a request, it will send the index.html file
app.get('/', (req, res)=>{
res.sendFile(path.join(__dirname + '/index.html'));
});