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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src="require.js"></script> | |
| <script> | |
| require(['jquery', 'underscore', 'backbone'], | |
| function($) | |
| { | |
| var UBlog = {}; |
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
| function! Rtest() | |
| ruby <<END | |
| line = $curbuf.line | |
| fn = nil | |
| if line =~ /^\s*test\s+["']([^"']+)["']\s+do/ | |
| fn = "test_#{$1.gsub(/ /, '_')}" | |
| elsif line =~ /^\s*def\s+(test_.+)/ | |
| fn = $1 | |
| end |
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
| require 'tempfile' | |
| require 'debugger' | |
| DEBUGGER_MONKEY_PATCH = <<'EOF' | |
| module Debugger | |
| class << self | |
| def stop_remote | |
| return unless @thread || @control_thread | |
| @stopped = true |
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
| # This assumes you have placed your public header files in the `Headers` | |
| # directory in your output directory. You can satisfy that easily by creating a | |
| # "Copy Files" build phase. See | |
| # http://image.bayimg.com/9cf4804007f7a7b59505de345ad2bbc388499475.jpg | |
| # Usage: | |
| # | |
| # 1. Change `PROJECT_NAME` below. E.g. if you have `Calculator.xcodeproj`, change it to `"Calculator"` | |
| # 2. Put this beside your `.xcodeproj` file, then just run `rake` |
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
| #!/usr/bin/env ruby | |
| # encoding: UTF-8 | |
| require 'nokogiri' | |
| require 'open3' | |
| html = Open3.popen2('redcarpet') do |stdin, stdout| | |
| stdin.write(STDIN.read) | |
| stdin.close |
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 Post < ActiveRecord::Base | |
| attr_accessible :body, :price, :title | |
| validates_presence_of :title | |
| validates_length_of :title, minimum: 10 | |
| validates_presence_of :body | |
| validates_numericality_of :price, greater_than: 0 | |
| end |
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 Post < ActiveRecord::Base | |
| attr_accessible :body, :price, :title | |
| validates_presence_of :title | |
| validates_length_of :title, minimum: 10 | |
| validates_presence_of :body | |
| validates_numericality_of :price, greater_than: 0 | |
| end |
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
| #!/bin/sh | |
| # | |
| # The MIT License (MIT) | |
| # | |
| # Copyright (c) 2013 Chris Yuen | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining a copy | |
| # of this software and associated documentation files (the "Software"), to deal | |
| # in the Software without restriction, including without limitation the rights | |
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
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
| // fun.cpp | |
| // This is for Lua 5.2, for Lua 5.1, see https://gist.github.com/kizzx2/1594905 | |
| #include <lua.hpp> | |
| #include <iostream> | |
| #include <sstream> | |
| class Foo | |
| { |
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
| var docs = []; | |
| for(var i = 0; i < 20000; i++) { | |
| docs.push({rnd: _rand(), t: "2013-06-23", N:7*i, A:1, V:0, n:"1234"}); | |
| } | |
| docs.sort(function(a, b) { | |
| return a.rnd - b.rnd; | |
| }); | |
| var t0 = Date.now(); | |
| db.foos.insert(docs); |