Skip to content

Instantly share code, notes, and snippets.

View niftydevelopment's full-sized avatar

Demas Sinner niftydevelopment

  • Demas Development AB
View GitHub Profile
@niftydevelopment
niftydevelopment / gist:d9adfb7e72d5b5a7c0fc
Created August 28, 2014 05:00
Angular controller test boilerplate
describe('Nu skall vi visa saker från git', function() {
var ctrl, scope;
beforeEach(module('git'));
beforeEach(inject(function($rootScope, $controller) {
$controller('GitController', {
@niftydevelopment
niftydevelopment / gist:3d03ef9bdfa19234ad00
Created August 28, 2014 12:37
TDD: test method boilerplate (eclipse, testng, mockito)
@Test
public void ${name}() {
${staticImport:importStatic('org.testng.Assert.*')}
${imp:import(org.testng.annotations.BeforeMethod,org.testng.annotations.Test,org.mockito.Mockito)}
${cursor}
}
@niftydevelopment
niftydevelopment / gist:194d863ab65cad890b45
Created August 28, 2014 13:27
TDD: setup test method boilerplate
@Test
@BeforeMethod
public void setup() {
MockitoAnnotations.initMocks(this);
${staticImport:importStatic('org.testng.Assert.*')}
${imp:import(org.testng.annotations.BeforeMethod,org.testng.annotations.Test,org.mockito.Mockito,org.mockito.MockitoAnnotations)}
${cursor}
}
Hej.
Jag behöver använda johnny-five biblioteket för att styra en stegmotor (Arduino).
Enligt kopplingsschemat behöver jag ett kontrollkort.
https://github.com/rwaldron/johnny-five/blob/master/docs/breadboard/stepper-driver.png
Det som används är följande från Pololu vilket inte går att fåtag på i Sverige:
https://www.pololu.com/product/1182
Jag är total nybörjare på detta. Men vad ni ett likvärdigt? Faktum är att jag tror ni har flera:
Faltarende.getSenasteSammanstalltResultat = function() {
var latestDatum = -1;
var latestResult = null;
this.kontroller.forEach(function(kontroll) {
if (kontroll.getSenasteSammanstalltResultatByTyp) {
var senasteSammanstalldaForKontroll = kontroll.getSenasteSammanstalltResultatByTyp('FALTARENDE');
if (senasteSammanstalldaForKontroll && senasteSammanstalldaForKontroll.skapadDen > latestDatum) {
int stp = 13; //connect pin 13 to step
int dir = 12; // connect pin 12 to dir
int a = 0; // gen counter
void setup()
{
pinMode(stp, OUTPUT);
pinMode(dir, OUTPUT);
}
Hello.
I am trying the "Minimal wiring diagram" and control the stepper motor with a Arduino.
https://www.pololu.com/product/1182
I fail to get any readings or any sign of life on the motor controller pins: 1a,1b, 2a and 2b.
This is the setup:
//jumper reset and sleep together
@niftydevelopment
niftydevelopment / demo.html
Created December 18, 2013 23:27
Koden från min föreläsning på Jönköping Developer Dojo
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
document.write("\<script src='resources/jQuery.js' type='text/javascript'>\<\/script>");
</script>
<script type="text/javascript">
//Följande modul kan man ladda ner till sin data här: https://gist.github.com/fatihacet/1290216
document.write("\<script src='resources/pubsub.js' type='text/javascript'>\<\/script>");
</script>
describe('Kopiera kontrollpunkter mellan ett Sammanställt Kontrollpunktsresultat och ett nytt Kontrollunderlag.', function () {
var http, $rootScope, sut, tester;
describe('Från källa', function () {
beforeEach(function () {
tester = ngMidwayTester('atlas.services');
sut = tester.inject('KontrollprotokollService');
http = tester.inject('$http');
Hello :-)
I watched your session yesterday regarding Angular 1.5 and components slightly after it was recorded.
Given some specific cases where I can´t replace a directive with a component (heavy DOM manipulation of some sort).
Question: Can I the mix when needed? Like: Component -* component -* directive or something similar?
I pretty sure that the answer is yes, but it kind of makes it hard do go down the components path if the answer is no.
Super tnx in advance :)