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
print 'lo so ' * 10000 |
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
int sensorValue; | |
int sensorLow = 1023; | |
int sensorHigh = 0; | |
const int ledPin = 13; | |
void setup() { | |
pinMode(ledPin, OUTPUT); | |
digitalWrite(ledPin, HIGH); | |
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
#include <Servo.h> | |
Servo myServo; | |
int const potPin = A0; | |
int potVal; | |
int angle; | |
void setup() { | |
myServo.attach(9); |
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
<?php | |
// You can use an abstract class as well | |
trait Cachable { | |
private $cache = []; | |
public function cached($method, $args) { | |
echo "[Cache] Called $method\n"; | |
if (!isset($this->cache[$method])) { |
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
<?php | |
trait Cachable { | |
private $cache = []; | |
public function cached($method, $args) { | |
echo "[Cache] Called $method\n"; | |
if (!isset($this->cache[$method])) { | |
echo "[Cache] Saving method in cache\n"; |
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
const int greenLEDPin = 9; | |
const int redLEDPin = 10; | |
const int blueLEDPin = 11; | |
const int redSensorPin = A0; | |
const int greenSensorPin = A1; | |
const int blueSensorPin = A2; | |
int redValue = 0; | |
int greenValue = 0; |
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
source 'https://rubygems.org' | |
gem 'sinatra' | |
gem 'thin' | |
gem 'data_mapper' | |
gem 'dm-sqlite-adapter' |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Hello React</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.12.2/react.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.12.2/JSXTransformer.js"></script> | |
</head> | |
<body> | |
<div id="main"></div> | |
<script type="text/jsx" src="main.js"></script> |
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
/** | |
* LRU Cache | |
* | |
* http://www.codewars.com/kata/53b406e67040e51e17000c0a | |
* | |
*/ | |
function LRUCache(capacity, init) { | |
var data = init || {}; | |
var timestamps = {}; | |
var capacity = capacity; |
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 callbackCurry(callbacks) { | |
var memoize = function memoize(xs) { | |
if (!xs.length) return null; | |
var tail = xs.slice(1), | |
head = xs[0]; | |
return head.bind(undefined, memoize(tail)); | |
}; |