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
# parse the duration of a FLV file from the metadata | |
def duration(file_name) | |
return -1 unless FileTest.exist?(file_name) | |
metadata = File.open(file_name, 'rb') do |file| | |
file.read(400) # bytes | |
end | |
offset = metadata =~ /duration/ |
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
# Rack Middleware to force all http requests to https | |
# Alternately you could do this with an Apache or Nginx rewrite | |
# | |
# Install this middleware in conf/environments/production.rb | |
# config.middleware.use "ForceSSL" | |
# | |
# You can optionally set the host name for the redirect | |
# config.middleware.use "ForceSSL", "example.com" | |
# | |
class ForceSSL |
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
# get git branch info using old bash function | |
# the zsh way to do this is vsc_info | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
# add git branch version to prompt | |
setopt PROMPT_SUBST | |
PROMPT='%n@%m %1~$(parse_git_branch) %# ' |
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
Ext.application({ | |
launch: function() { | |
// define our app here | |
} | |
}); |
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
*.bak | |
thumbs.db | |
App_Data/ | |
bin/ | |
obj/ | |
Bin/ | |
_ReSharper.*/ | |
tmp/ |
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
// | |
// Write "Hello, world!" in a plain text NDEF message | |
// Tag must be a Mifare Classic with a 4 byte ID | |
// Tested with Samsung TecTile | |
// | |
#include <Wire.h> | |
#include <Adafruit_NFCShield_I2C.h> | |
#define IRQ (2) | |
#define RESET (3) // Not connected by default on the NFC Shield |
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
// handle unformatted tags | |
nfc.addNdefFormatableListener( | |
function (nfcEvent) { | |
// NDEF message with one record | |
var message = [ | |
ndef.textRecord("hello, world") | |
]; | |
nfc.write( |
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
cd ~/Documents/Arduino/libraries | |
git clone git@github.com:adafruit/Adafruit_NFCShield_I2C.git | |
git clone git@github.com:don/Ndef.git |
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
var macAddress = "00:00:AA:BB:CC:DD"; | |
var connected = function() { | |
// connected, do something | |
}; | |
var disconnected = funtion(error) { | |
// disconnected | |
}; | |
bluetoothSerial.connect(macAddress, connected, disconnected); |
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 <Wire.h> | |
#include <Adafruit_NFCShield_I2C.h> | |
#include <NfcAdapter.h> | |
NfcAdapter nfc = NfcAdapter(); | |
#include <Adafruit_NeoPixel.h> | |
// Parameter 1 = number of pixels in strip | |
// Parameter 2 = pin number (most are valid) |
OlderNewer