- Start a Sinatra server on port 4000
- GET / to that server triggers a
git pull
and mod_rails restart - Hit port 4000 locally after pushing
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
<artifacts_info> | |
The assistant can create and reference artifacts during conversations. Artifacts are for substantial, self-contained content that users might modify or reuse, displayed in a separate UI window for clarity. | |
# Good artifacts are... | |
- Substantial content (>15 lines) | |
- Content that the user is likely to modify, iterate on, or take ownership of | |
- Self-contained, complex content that can be understood on its own, without context from the conversation | |
- Content intended for eventual use outside the conversation (e.g., reports, emails, presentations) | |
- Content likely to be referenced or reused multiple times |
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
// This snippet is an example on how the detecting overlaping annotations | |
// was implemented inside the Substance Composer app. | |
function annotate(type) { | |
// Check for existing annotation | |
var sel = this.surface.selection(); | |
if (!sel) return; | |
if (_.include(["em", "str"], type)) { |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'sinatra' | |
require 'spira' | |
require 'rack/linkeddata' | |
use Rack::LinkedData::ContentNegotiation, :default => 'text/turtle' | |
include RDF |
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
class SignupController < ActionController::Base | |
def step_two | |
@signup = Signup.find(params[:id]) | |
@signup.advance_step do |signup| | |
signup.attributes = params[:signup] | |
signup.save! | |
end | |
end | |
end |
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
require 'lib/usher' | |
u = Usher::Interface.for(:text) do | |
on('my name is :name') { |name| | |
puts "hey #{name}, nice to meet you" | |
} | |
on('hey :first_name( :last_name)') {|first_name, last_name| | |
puts last_name ? | |
"how are you doing #{first_name} #{last_name}?" : |
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
# Make port 80 "real life" speeds | |
# You can also use Mongrel ports. | |
function slow_port { | |
# Set the port variable if no port inputted. Defaulted to 80 (for Passenger). | |
if [ -z "$1" ] | |
then port=80 | |
else port=$1 | |
fi | |
# Slow the ports. |
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
class AddAccountNotes < TableMigration | |
migrates :accounts, :multi_pass => false, :create_temp_table => false, :dry_run => false | |
schema_changes.push <<-SQL | |
ALTER TABLE :new_table_name | |
ADD COLUMN `notes` VARCHAR(255) | |
SQL | |
schema_changes.push <<-SQL | |
ALTER TABLE :new_table_name |
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
// only outputs if console available and does each argument on its own line | |
function log() { | |
if (window && window.console && window.console.log) { | |
var i, len; | |
for (i=0, len=arguments.length; i<len; i++) { | |
console.log(arguments[i]); | |
} | |
} | |
} |