Skip to content

Instantly share code, notes, and snippets.

View JavascriptMick's full-sized avatar

JavascriptMick JavascriptMick

View GitHub Profile
@JavascriptMick
JavascriptMick / kuramoto.go
Created June 19, 2022 03:25
Simple Kuramoto simulation in Go
package main
import (
"fmt"
"math"
)
// The coupling constant, higher values tend to converge the model faster
const k_const float64 = .006
@JavascriptMick
JavascriptMick / README.md
Created December 28, 2021 02:29
Simple Python SQS Unordered Job Queue Implementation

Instructions

  1. Create an AWS account
  2. Create an SQS queue (standard type, not fifo)
  3. Ensure that the environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are set
  4. use requirements.txt to get requirements (no I'm not using Celery at all, this is just a cheat way of getting the right dependencies)
  5. See usage.py for how to enqueue jobs
  6. run the worker to... work

python3 worker.py

@JavascriptMick
JavascriptMick / GetNasty.js
Created February 29, 2016 21:55
Use a Higher order component to add mouse events to a host component
import React from "react";
export default function GetNasty(TargetComponent){
return class GetNasty extends React.Component{
handleOnClick($event){
alert("You suck!");
}
render(){
const props = Object.assign({
@JavascriptMick
JavascriptMick / DraggableComponent.js
Last active March 1, 2016 21:15
Adding Draggable behaviour to a React component
import React from "react";
export default class DraggableComponent extends React.Component{
constructor(props){
super(props);
this.isDragging = false;
this.originalClientX = 0;
this.originalClientY = 0;
this.originalTop = 0;
this.originalLeft = 0;
@JavascriptMick
JavascriptMick / frontend.js
Created November 8, 2015 21:55
Horrible Kluge to make ghost support my legacy Blogger URL's
var frontend = require('../controllers/frontend'),
config = require('../config'),
express = require('express'),
utils = require('../utils'),
frontendRoutes;
frontendRoutes = function frontendRoutes(middleware) {
var router = express.Router(),
subdir = config.paths.subdir,
@JavascriptMick
JavascriptMick / TextController.cs
Created April 19, 2015 05:52
Better Engine for Text101
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Collections.Generic;
public class TextController : MonoBehaviour {
public Text questionText;
private enum StateKey {Car, OpenWindow, Docs, MissingDog, DeadBug, Freakout, Police, Haircut, Court, PayFine, GoldCoast};
private StateKey currentState;
@JavascriptMick
JavascriptMick / index.html
Last active September 13, 2019 12:11
Thinking in React
<html>
<head>
<script src="bower_components/react/react.js"></script>
<script src="bower_components/react/JSXTransformer.js"></script>
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" type="text/css"/>
</head>
<body>
<div class="container" id="container">
</div>
@JavascriptMick
JavascriptMick / config_dev.js
Last active August 29, 2015 14:14
Integration Testing a Restful Endpoint with Request and Jasmine and Node.JS
//*****useage*******
//var config = require('config_' + (process.env.NODE_ENV || 'dev'));
console.log('*** using dev config ***');
exports.mongo_db_address = 'localhost';
exports.mongo_db_port = 27017;
exports.mongo_db_name = 'myDB';
exports.mongo_db_user = null;
exports.mongo_db_pass = null;
@JavascriptMick
JavascriptMick / install fail
Created April 23, 2014 10:29
mean.io fail install
Michaels-MacBook-Pro:Workspace michael$ sudo npm install -g meanio@latest
Password:
npm http GET https://registry.npmjs.org/meanio
npm http 304 https://registry.npmjs.org/meanio
npm WARN engine [email protected]: wanted: {"node":"0.10.x","npm":"1.4.x"} (current: {"node":"v0.10.15","npm":"1.3.5"})
npm http GET https://registry.npmjs.org/colors
npm http GET https://registry.npmjs.org/commander
npm http GET https://registry.npmjs.org/lodash
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/mongodb
@JavascriptMick
JavascriptMick / output.txt
Last active August 29, 2015 13:57
poc using registry to look at files existing as @ listen
Michaels-MacBook-Pro:hackify_ruby michael$ bundle exec ruby poc.rb
b.js
subfolder
a.js
^Cpoc.rb:16:in `sleep': Interrupt
from poc.rb:16:in `<main>'
Michaels-MacBook-Pro:hackify_ruby michael$ bundle exec ruby poc.rb
fiddleWithAsync.js
^Cpoc.rb:16:in `sleep': Interrupt