Skip to content

Instantly share code, notes, and snippets.

def test_youtube_parser
url1 = "http://www.youtube.com/watch?v=E4Fbk52Mk1w"
just_an_id = 'E4Fbk52Mk1w'
url_without_http = "www.youtube.com/watch?v=E4Fbk52Mk1w"
url_without_www = "youtube.com/watch?v=E4Fbk52Mk1w"
url_with_feature = "http://www.youtube.com/watch?feature=player_embedded&v=E4Fbk52Mk1w"
expected_output = 'E4Fbk52Mk1w'
assert_equal expected_output,
@TheNotary
TheNotary / b.rb
Last active December 15, 2015 18:59
module RubyBBCode
# This class builds objects that hold TagNodes. It's really just a simple array, with the addition of the #to_html method
class TagCollection < Array
class HtmlTemplate
def initialize(tag_definition)
@tag_definition = tag_definition
@data = tag_definition[:html_open].dup
end
class ::Template # < ::String
def initialize(blah)
@data = blah
end
def to_s
@data
end
end
@TheNotary
TheNotary / MyGemFunctions.java
Created April 6, 2013 19:12
plugins/com.aptana.editor.ruby/src/org/eclipse/ui/texteditor/MyGemFunctions.java
public static String getGemsDirectory()
{
try
{
Process proc = Runtime.getRuntime().exec("which ruby");
BufferedReader stdInput = new BufferedReader(new
InputStreamReader(proc.getInputStream()));
BufferedReader stdError = new BufferedReader(new
action@first-box-4281:~/dev/rails/scroll-forge$ bundle exec rake db:migrate
rake aborted!
(<unknown>): found character that cannot start any token while scanning for the next token at line 6 column 1
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
file_hacks:
- make_things_better:
starting_md5: "k1j23lkj213"
patches:
-
string_to_patch: "function patchThisLine(){" # this is regex
replace_with: "function withThisLine(){"
patch_multiple: false
-
string_to_patch: "function anotherLine(){"
require 'yaml'
require 'open-uri'
URL = "https://github.com/TheNotary/the_notarys_linux_mint_postinstall_configuration"
def valid_yaml_string?(yaml)
!!YAML.load(yaml)
rescue Exception => e
STDERR.puts e.message
return false
50 4B 03 04 0A 03 00 00 00 00 9A 85 4C 43 05 40 6D 5B 08 00 00 00 08 00 00 00 01 00 00 00 61 68 65 6C 6C 6F 20 61 0A 50 4B 03 04 0A 03 00 00 00 00 B8 85 4C 43 C6 13 40 70 08 00 00 00 08 00 00 00 01 00 00 00 62 68 65 6C 6C 6F 20 62 0A 50 4B 01 02 3F 03 0A 03 00 00 00 00 9A 85 4C 43 05 40 6D 5B 08 00 00 00 08 00 00 00 01 00 00 00 00 00 00 00 00 00 20 80 A4 81 00 00 00 00 61 50 4B 01 02 3F 03 0A 03 00 00 00 00 B8 85 4C 43 C6 13 40 70 08 00 00 00 08 00 00 00 01 00 00 00 00 00 00 00 00 00 20 80 A4 81 27 00 00 00 62 50 4B 05 06 00 00 00 00 02 00 02 00 5E 00 00 00 4E 00 00 00 00 00
from arcpy import da
import os
inTable = arcpy.GetParameterAsText(0)
fileLocation = arcpy.GetParameterAsText(1)
with da.SearchCursor(inTable,['DATA','ATT_NAME']) as cursor:
for row in cursor:
binaryRep = row[0]
fileName = row[1]
(Map.h)
#ifndef HEADER_MAP
#define HEADER_MAP
class Map {
public:
Map(uint8_t walls_bmp[8]);
uint8_t walls[8];
void draw(Adafruit_BicolorMatrix matrix);
};