This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Motor Code Adopted From: http://www.instructables.com/id/Control-your-motors-with-L293D-and-Arduino/?ALLSTEPS | |
int motor_left[] = {2, 3}; | |
int motor_right[] = {7, 8}; | |
void setup() { | |
for(int i = 0; i < 2; i++){ | |
pinMode(motor_left[i], OUTPUT); | |
pinMode(motor_right[i], OUTPUT); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Ping Code Adopted From: https://bitbucket.org/teckel12/arduino-new-ping/wiki/Home#!single-pin-sketch | |
#include <NewPing.h> | |
#define PING_PIN 12 // Arduino pin tied to both trigger and echo pins on the ultrasonic sensor. | |
#define PING_MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm. | |
NewPing sonar(PING_PIN, PING_PIN, PING_MAX_DISTANCE); // NewPing setup of pin and maximum distance. | |
void setup() { | |
Serial.begin(9600); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DATABASE oracle; | |
\c oracle; | |
CREATE TABLE matrix("the 1" varchar); | |
INSERT INTO matrix VALUES('Neo'); | |
SELECT "the 1" FROM matrix; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Delete all indices | |
curl -XDELETE localhost:9200/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
unset DISPLAY | |
if [ ! -f /tmp/.X99-lock ]; then | |
Xvfb :99 -ac & | |
fi | |
export DISPLAY=:99 | |
bundle install --path ../bundle --quiet --without development production && |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var update = function() { | |
$('.card-short-id').removeClass('hide').css('font-weight',700); | |
$('.list-header-num-cards').removeClass('hide').css('font-weight',700); | |
}; | |
$(document).ready(function() { | |
update(); | |
setInterval(update, 5000); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Credits: Adam's answer in http://stackoverflow.com/a/20786262/69362 | |
// Paste this in browser's console | |
var $rootScope = angular.element(document.querySelectorAll("[ui-view]")[0]).injector().get('$rootScope'); | |
$rootScope.$on('$stateChangeStart',function(event, toState, toParams, fromState, fromParams){ | |
console.log('$stateChangeStart to '+toState.to+'- fired when the transition begins. toState,toParams : \n',toState, toParams); | |
}); | |
$rootScope.$on('$stateChangeError',function(event, toState, toParams, fromState, fromParams){ | |
console.log('$stateChangeError - fired when an error occurs during transition.'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Creating promise which resolves after all promises are resolved | |
var deferrable = $q.defer(); | |
var promises = []; | |
promises.push(fooPromise); | |
promises.push(barPromise); | |
$q.all(promises).then(function(){ | |
deferrable.resolve(); | |
}) | |
return deferrable.promise; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('overlay', []) | |
.factory('overlay', function () { | |
var enabled = true; | |
var show = function(){ | |
if(enabled) | |
$('#overlay').show(); | |
} | |
var hide = function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Basics | |
"foo" // string | |
'foo' // string | |
var foo = {} // new object | |
[1, 2, "foo", "bar"] // new array | |
var foo = { | |
name: 'Foo', | |
Greet: function(otherName){ | |
console.log("Hello I am " + this); | |
console.log("Hello " + otherName + " my name is " + this.name); |