Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am isma44 on github.
  • I am morije (https://keybase.io/morije) on keybase.
  • I have a public key ASDI8Ed5qY0I0nbNiiKdsy_n0neRdUb5lVLv9U9DsGixMAo

To claim this, I am signing this object:

@isma44
isma44 / gist:64038cc6296ea8becf2d
Last active Sep 5, 2015 — forked from rais38/gist:4683817
Embed YouTube videos with UIWebView
View gist:64038cc6296ea8becf2d
#pragma mark - Embed Video
- (UIWebView *)embedVideoYoutubeWithURL:(NSString *)urlString andFrame:(CGRect)frame {
NSString *videoID = [self extractYoutubeVideoID:urlString];
NSString *embedHTML = @"\
<html><head>\
<style type=\"text/css\">\
body {\
background-color: transparent;\
@isma44
isma44 / gist:9c1d19e646afb68d9f0e
Created Feb 21, 2015
Ricoh Theta Test by Node.js
View gist:9c1d19e646afb68d9f0e
// for Mac
// module.paths.push('/usr/local/lib/node_modules');
var Theta = require('ricoh-theta');
var theta = new Theta();
theta.connect('192.168.1.5');
// capture
theta.on('connect', function(){
View main.c
#define LEDPORT PORTD
#define LEDBIT PD6
#define LEDDDR DDRD
#include <avr/io.h>
int main (void)
{
LEDDDR |= (1 << LEDBIT); // set LED pin as an output
TCCR1B |= ((1 << CS10) | (1 << CS11)); // configure timer prescaling
View macros.h
// super awesome Arduino-like pin macros save you from having to remember bitmasks
// code from Matthew T. Pandina's Demystifying the TLC5940 tutorial:
// URL: https://sites.google.com/site/artcfox/demystifying-the-tlc5940
#define setOutput(ddr, pin) ((ddr) |= (1<< (pin)))
#define setLow(port, pin) ((port) &= ~(1 << (pin)))
#define setHigh(port, pin) ((port) |= (1 << (pin)))
#define outputState(port, pin) ((port) & (1 << (pin)))
#define pulse(port, pin) do { \
setHigh((port), (pin)); \
View drive_led_with_button.js
var fs = require('fs');
var button_gpio = 17; // maps to digital PIN5 on the board
var led_gpio = 27; // maps to digital PIN7
var fileOptions = {encoding: 'ascii'};
var exportGpio = function(gpio_nr) {
fs.writeFile('/sys/class/gpio/export', gpio_nr, fileOptions, function (err) {
if (err) { console.log("Couldn't export %d, probably already exported.", gpio_nr); }