This file contains hidden or 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
| .directive("keepScrollPos", function($route, $window, $timeout, $location, $anchorScroll) { | |
| // cache scroll position of each route's templateUrl | |
| var scrollPosCache = {}; | |
| // compile function | |
| return function(scope, element, attrs) { | |
| scope.$on('$routeChangeStart', function() { | |
| // store scroll position for the current view | |
| if ($route.current) { |
This file contains hidden or 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
| // First, the .csv file needs to be saved in a place where the project will be able to access it: | |
| // Create a folder called "data" and place it in the project's folder. | |
| // The .csv file should be placed inside of that "data" folder. | |
| void setup() { | |
| Table data; | |
| // Load in the .csv file. Note that the first row of this file names each of the columns (AKA a header row) | |
| data = loadTable("absences.csv", "header"); | |
| // Use a while loop to iterate through all of the rows... |
This file contains hidden or 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
| void setup() { | |
| size(179*2, 179); | |
| // Load the original image | |
| PImage pic = loadImage("http://cdn.theatlantic.com/static/mt/assets/business/smiley%20face%20wikimedia.png"); | |
| // Draw the original image at 0, 0 | |
| image(pic, 0, 0); | |
| // Iterate through all of the pixels on the left half of the window | |
| int yCoord = 0; | |
| while(yCoord < height){ |
This file contains hidden or 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
| // The following gist assumes that you have a data folder with a file called helloWorld.noah in it | |
| String[] lines; | |
| void setup() { | |
| lines = loadStrings("helloWorld.noah"); | |
| size(500, 500); | |
| for (String line : lines) { | |
| String[] tokens = line.split(" "); | |
| println(line); | |
| } |
This file contains hidden or 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
| #include <Wire.h> | |
| #include <SPI.h> | |
| #include <Adafruit_PN532.h> | |
| // If using the breakout with SPI, define the pins for SPI communication. | |
| #define PN532_SCK (2) | |
| #define PN532_MOSI (3) | |
| #define PN532_SS (4) | |
| #define PN532_MISO (5) |
This file contains hidden or 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
| class Particle { | |
| PVector location; | |
| PVector velocity; | |
| PVector acceleration; | |
| PVector gravity; | |
| Particle() { | |
| location = new PVector(width/2, 0); | |
| velocity = new PVector(0, 0); | |
| acceleration = new PVector(random(-.3, .3), 0); |
This file contains hidden or 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
| class Particle { | |
| PVector location; | |
| PVector velocity; | |
| PVector acceleration; | |
| PVector gravity; | |
| Particle() { | |
| location = new PVector(width/2, 0); | |
| velocity = new PVector(0, 0); | |
| acceleration = new PVector(random(-.3, .3), 0); |
This file contains hidden or 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
| #include <Adafruit_NeoPixel.h> | |
| #define PIN 6 | |
| // Parameter 1 = number of pixels in strip | |
| // Parameter 2 = pin number (most are valid) | |
| // Parameter 3 = pixel type flags, add together as needed: | |
| // NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs) | |
| // NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers) | |
| // NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products) |
This file contains hidden or 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
| int[] primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97}; |
This file contains hidden or 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
| void setup() { | |
| size(500, 500); | |
| } | |
| void draw() { | |
| background(255); | |
| drawStar(mouseX, mouseY); | |
| } | |
| // Draw a star | |
| // (How? Up to you. I'd recommend a * shape with five lines originating from the center) |
NewerOlder