Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jgilless on github.
  • I am jgilless (https://keybase.io/jgilless) on keybase.
  • I have a public key whose fingerprint is 0921 FBAE EC70 C716 6697 13B1 786F 3370 267A 3902

To claim this, I am signing this object:

@jgilless
jgilless / autoclicker.py
Created November 13, 2014 03:59
Autoclicker for Clicker Heroes
#simplest autoclicker ever
import win32api
import win32con
import time
import sys
def click(x,y):
win32api.SetCursorPos((x,y))
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
@jgilless
jgilless / euler1.rb
Last active August 29, 2015 14:09
Ruby solution for Project Euler problem 1
# https://projecteuler.net/problem=1
puts "Find the sum of all the multiples of 3 or 5 below which number?"
STDOUT.flush #clears the buffer
max_num = Integer(gets.chomp)
def sum_x3_x5(num)
sum = 0
(1..num).each do |n|
sum = sum + n if (n % 3 == 0) || (n % 5 == 0) #Add if n is divisible by 3 or 5
@jgilless
jgilless / euler2.rb
Last active August 29, 2015 14:09
Ruby solution for Project Euler problem 2
# https://projecteuler.net/problem=2
puts "Find the sum of even valued Fibonnaci terms which values do not exceed:"
STDOUT.flush #clears the buffer
num = Integer(gets.chomp)
def fibonacci(max_num)
fibonacci = [1,2] #first two numbers of the sequence
while fibonacci[-2] + fibonacci[-1] < max_num
fibonacci << fibonacci[-2] + fibonacci[-1] # next num in sequence
@jgilless
jgilless / euler3.rb
Created November 14, 2014 19:03
Ruby solution for Project Euler problem 3
# https://projecteuler.net/problem=3
puts "Find the largest prime factor of:"
STDOUT.flush #clears the buffer
max_num = Integer(gets.chomp)
def largest_prime_factor(num)
largest_factor = 1
#get rid of factors of 2
@jgilless
jgilless / application_helper.rb
Last active August 29, 2015 14:10
Application Helper for Blog Post
module ApplicationHelper
def markdown(text)
render_options = {
#do not allow any user-inputted HTML in the output.
filter_html: true,
#do not generate any <img> tags.
#no_images: true,
#do not generate any <a> tags.
#no_links: true,
#do not generate any <style> tags.

Use Case: Name of Use Case

Actors

  • List of all actors involved in the use case
  • Each actor should be distinct
  • Generalize to User and System before getting specific
  • Refer to each actor exactly as listed here through the rest of the document

Brief

Provide a brief overview (~paragraph) of what the use case includes. Roughly equivalent to a user story or an epic.

@jgilless
jgilless / create-next-redux-app.sh
Last active December 7, 2017 00:05
Create Next App, instant regret writing it in bash not node.
#!/bin/bash
if [ -z "$1" ]
then
echo "No argument supplied"
exit 1
fi
mkdir $1 && cd $1
@jgilless
jgilless / create-next-redux-app.js
Created December 7, 2017 02:41
Nextjs + Redux + React app with opinionated architecture.
const fs = require('fs');
const { execSync } = require('child_process');
if (!process.argv[2]) {
console.log('useage: node create-next-app.js <appname>');
process.exit(1);
}
const rootFolder = process.argv[2];
javascript:(function (d) {
var tables = d.getElementsByTagName('table'),
head = d.head || d.getElementsByTagName('head')[0],
styleElement = d.createElement('style'),
cssStr = '.table-flip {transition: 1s linear;transform: rotate(360deg);}';
styleElement.type = 'text/css';
styleElement.appendChild(d.createTextNode(cssStr));
head.appendChild(styleElement);
function toggleSpin() {
var i = 0,