Skip to content

Instantly share code, notes, and snippets.

View TechplexEngineer's full-sized avatar

Blake Bourque TechplexEngineer

View GitHub Profile
@TechplexEngineer
TechplexEngineer / javascript_resources.md
Last active August 29, 2015 14:08 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@TechplexEngineer
TechplexEngineer / python_resources.md
Last active August 29, 2015 14:08 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides

// hasClass, takes two params: element and classname
function hasClass(el, cls) {
return el.className && new RegExp("(\\s|^)" + cls + "(\\s|$)").test(el.className);
}
/* use like below */
// Check if an element has class "foo"
if (hasClass(element, "foo")) {
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type.
jQuery.noConflict();
import threading
def set_interval(func, sec):
def func_wrapper():
set_interval(func, sec)
func()
t = threading.Timer(sec, func_wrapper)
t.start()
return t
@TechplexEngineer
TechplexEngineer / 1_error
Created December 23, 2014 23:14
Blockly Headless
<path to>/blockly_compressed.js:70
ssertionError";goog.asserts.DEFAULT_ERROR_HANDLER=function(a){throw a;};goog.a
^
AssertionError: Assertion failed: Error: "controls_if" is an unknown language block.
at new goog.asserts.AssertionError (/home/techplex/Documents/projects/blockly/blockly/blockly_compressed.js:70:597)
at Object.goog.asserts.doAssertFailure_ (/home/techplex/Documents/projects/blockly/blockly/blockly_compressed.js:71:126)
at Object.goog.asserts.assertObject (/home/techplex/Documents/projects/blockly/blockly/blockly_compressed.js:74:104)
at Blockly.Block.fill (/home/techplex/Documents/projects/blockly/blockly/blockly_compressed.js:987:485)
at Blockly.Block.initialize (/home/techplex/Documents/projects/blockly/blockly/blockly_compressed.js:986:401)
at Function.Blockly.Block.obtain (/home/techplex/Documents/projects/blockly/blockly/blockly_compressed.js:986:269)
wget https://github.com/google/closure-library/archive/master.zip
unzip master.zip
mv closure-library-master closure-library
@TechplexEngineer
TechplexEngineer / xbox.java
Created February 1, 2015 00:53
xbox controller frc code untested
public class XboxController {
private Joystick joystick_;
XboxController(int port) {
joystick_ = new Joystick(port);
}
public boolean isA() {
joystick_.getRawButton(0);
import edu.wpi.first.wpilibj.Joystick;
public class Example {
public Example() {
Joystick a = new Joystick(1);
Joystick b = new Joystick(1);
Xbox x = (Xbox) b; //this is what I wanted to do
Xbox_1 = new Xbox_1(b); //this is what I ended up doing
}
}
@TechplexEngineer
TechplexEngineer / map.java
Last active August 29, 2015 14:15
map a number from one range to another
/**
* map a number from one range to another
* @param {num} value the value to be mapped
* @param {num} old_min the minimum of value
* @param {num} old_max the maximum of value
* @param {num} new_min the new minimum value
* @param {num} new_max the new maximum value
* @return {num} the value remaped on the range [new_min new_max]
*/
public double map(double value, double old_min, double old_max, double new_min, double new_max) {