Skip to content

Instantly share code, notes, and snippets.

View dorkitude's full-sized avatar

Kyle Wild dorkitude

View GitHub Profile
@dorkitude
dorkitude / bouncing_ball.py
Created December 21, 2022 17:14
basic game on pygame
import pygame
# Initialize Pygame
pygame.init()
# Set the window size and title
screen_size = (600, 400)
screen = pygame.display.set_mode(screen_size)
pygame.display.set_caption("Bouncing Ball")
@dorkitude
dorkitude / paragraphs cut.txt
Created March 15, 2017 20:54
gist saving this for later
Most analytics tools are made to help app makers study what users are doing in some specific type of app. This kind of tool works okay, provided your app looks enough like the others apps the tool was built for, and your users’ behaviors are enough like the behaviors in those other apps. What if your app is unique, and the questions you have are unique? (Before Keen, the state of the art was to build your own Observatory from scratch.)
The data model breadth of those tools may not be enough for you. What if user behavior in the app layer is only a part of your business? What if you want to study your marketing website copy, your paid acquisition funnel, the response time performance of your your webservices layer, all in the same system? (Before Keen, the state of the art was to build your own Observatory from scratch.)
What if you want other humans — your customers, your partners, your merchants, or just other departments in your company — to get value from the same data? What if you wanted applications to
@dorkitude
dorkitude / in_viewport.js
Created December 19, 2016 22:49 — forked from michelbio/in_viewport.js
check if element is in viewport - vanilla JS. Use by adding a “scroll” event listener to the window and then calling isInViewport().
// Determine if an element is in the visible viewport
// The function could be used by adding a “scroll” event listener to the window and then calling isInViewport().
function isInViewport(element) {
let rect = element.getBoundingClientRect();
let html = document.documentElement;
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || html.clientHeight) &&
rect.right <= (window.innerWidth || html.clientWidth)
@dorkitude
dorkitude / in_viewport.js
Created December 19, 2016 22:49 — forked from jjmu15/in_viewport.js
check if element is in viewport - vanilla JS. Use by adding a “scroll” event listener to the window and then calling isInViewport().
// Determine if an element is in the visible viewport
function isInViewport(element) {
var rect = element.getBoundingClientRect();
var html = document.documentElement;
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || html.clientHeight) &&
rect.right <= (window.innerWidth || html.clientWidth)
);
This is just one small piece of this mostrosity.
read on.
MEDICARE AT AGE 76, IMPORTANT PLEASE READ - ANYONE WHO DOUBTS THIS IS
TRUE CAN DOWNLOAD THE NEW OBAMA CARE AND LOOK UP THE PAGES MENTIONED.
THIS IS JUST THE BEGINNING......................PLEASE PASS THIS
OUTRAGE TO EVERYONE ON YOUR LIST!!! THIS should be read by everyone,
especially important to those over 75....... If you are younger, then
it may apply to your parents....
Keen.configure(window.ENV.keenProjectId,window.ENV.keenApiKey),
Keen.onChartsReady(function(){
var e=new Keen.Series("connect",{
analysisType:"count",
timeframe:"last_7_days",
interval:"daily"
}),
t=new Keen.Series("connect",{
adroit@Kyles-MacBook-Air:~/Dropbox/dev/Keen-Clients/ $ gem install keen
Building native extensions. This could take a while...
ERROR: Error installing keen:
ERROR: Failed to build gem native extension.
/Users/adroit/.rvm/rubies/ruby-1.9.2-p136/bin/ruby mkrf_conf.rb
"/Users/adroit/.rvm/rubies/ruby-1.9.2-p136/bin/ruby" -rubygems /Users/adroit/.rvm/gems/ruby-1.9.2-p136@global/gems/rake-0.8.7/bin/rake RUBYARCHDIR=/Users/adroit/.rvm/gems/ruby-1.9.2-p136/gems/keen-0.1.6/lib RUBYLIBDIR=/Users/adroit/.rvm/gems/ruby-1.9.2-p136/gems/keen-0.1.6/lib
rake aborted!
no such file to load -- bundler
@dorkitude
dorkitude / gist:1511815
Created December 22, 2011 20:53
git convenience functions from my Mac's .profile
# git convenience functions
function grso() {
git remote show origin ;
}
function mkremotebranch() {
git branch "$@" ;
git checkout "$@" ;
git push -u origin "$@" ;
}
@dorkitude
dorkitude / gist:1398138
Created November 27, 2011 20:58
A sample use case for DSTruct: Remote Resource
"""
A sample use case for DSTruct ( https://github.com/dorkitude/dstruct )
Let's pretend we're implementing the in-app purchase feature of a mobile game,
and there's a remote payments API over which we have no control. To make
matters worse, their API doesn't support versioning and their client library
isn't properly encapsulated, so when they make an update to the API spec, we
have to handle it in our code. As a result, our spec demands type checking not
only to preempty failures when we post resources, but to vet the response.
class BaseTestCase(unittest.TestCase):
"""
Extend this with your test cases to get some sweet shit!
- Provides:
- Instance methods:
- self.persist_item(item) # Use instead of item.save()
- self.set_up()
- a subclass's method *must* call super