Skip to content

Instantly share code, notes, and snippets.

@jeantimex
jeantimex / parse-options.sh
Created July 31, 2020 01:57 — forked from cosimo/parse-options.sh
Example of how to parse options with bash/getopt
#!/bin/bash
#
# Example of how to parse short/long options with 'getopt'
#
OPTS=`getopt -o vhns: --long verbose,dry-run,help,stack-size: -n 'parse-options' -- "$@"`
if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
echo "$OPTS"
@jeantimex
jeantimex / Vector2D.js
Created July 29, 2020 07:11
JavaScript 2D Vector Class
/*
Simple 2D JavaScript Vector Class
Hacked from evanw's lightgl.js
https://github.com/evanw/lightgl.js/blob/master/src/vector.js
*/
function Vector(x, y) {
@jeantimex
jeantimex / iPod.swift
Created July 28, 2020 04:49 — forked from jordansinger/iPod.swift
Swift Playgrounds iPod Classic
import SwiftUI
import PlaygroundSupport
struct iPod: View {
var body: some View {
VStack(spacing: 40) {
Screen()
ClickWheel()
Spacer()
}

From https://www.silentorbit.com/notes/2013/rsync-by-extension/

Having a file structure full of various file types you want to sync only files of one type into a new location.

rsync -rv --include '*/' --include '*.js' --exclude '*' --prune-empty-dirs Source/ Target/

This will generate the same structure found in Source into Target but only including the JavaScript(.js) files.

@jeantimex
jeantimex / webpack.config.js
Created June 19, 2020 15:08 — forked from ayastreb/webpack.config.js
Build Chrome Extension with React using Webpack
const path = require('path')
const webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
module.exports = {
// Entry files for our popup and background pages
entry: {
popup: './src/popup.js',
@jeantimex
jeantimex / background.js
Created June 10, 2020 06:58
Simple Chrome extension
var toggle = false;
chrome.browserAction.onClicked.addListener(function (tab) {
toggle = !toggle;
if (toggle){
// chrome.browserAction.setIcon({path: "on.png", tabId:tab.id});
chrome.tabs.executeScript(tab.id, {file: "color-picker.js"});
} else {
//chrome.browserAction.setIcon({path: "off.png", tabId:tab.id});
//chrome.tabs.executeScript(tab.id, {code: "alert('hello')"});
const express = require('express');
const app = express();
app.use(express.static('public'));
app.get('/', (req, res) => {
res.send('An alligator approaches!');
});
app.listen(3000, () => console.log('Gator app listening on port 3000!'));
@jeantimex
jeantimex / .block
Last active April 26, 2020 23:46
Simple line chart with grid lines
license: mit
@jeantimex
jeantimex / .block
Last active April 25, 2020 23:21
A simple line chart
license: mit
@jeantimex
jeantimex / .block
Last active April 25, 2020 23:03
How to draw a us map
license: mit