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
<div id="app">Loading...</div> |
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
<template> | |
<h1>from app tpl</h1> | |
<router-view></router-view> | |
</template> |
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 'rubygems' | |
require 'rack' | |
class Object | |
def webapp | |
class << self | |
define_method :call do |env| | |
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?) | |
[200, {}, send(func, *attrs)] | |
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
curl -u your_gmail_account:your_password --silent "https://mail.google.com/mail/feed/atom" | tr -d 'n' | awk -F '' '{for (i=2; i<=NF; i++) {print $i}}' | sed -n "s/<title>\(.*\)<\/title.*name>\(.*\)<\/name>.*/\2 - \1/p" |
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 PurchaseOrder | |
include DataMapper::Resource | |
storage_names[:default] = ... | |
property :id, Serial, :field => 'purchaseorderindex' | |
... | |
property :closed_date, Date, :field => 'closeddate' | |
... | |
has n, :items, :model => 'PurchaseOrderLineItem', :child_key => [:po_id, Integer], :deleted => false |
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
namespace :ordering do |order| | |
order.resources :codebook2s do |cb2| | |
cb2.resources :codebook2_line_items | |
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
# merb-core-1.0.9/lib/merb-core/dispatch/router/route.rb | |
- SEGMENT_REGEXP_WITH_BRACKETS = /(:[a-z_]+)(\[(\d+)\])?/ | |
+ SEGMENT_REGEXP_WITH_BRACKETS = /(:[a-z0-9_]+)(\[(\d+)\])?/ |
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
def generate_daily_pos_report | |
# create a fake request | |
fake_request = Merb::Request.new({}) | |
# init the controller | |
controller = Purchasing::Reports.new(fake_request) | |
# gets all the pos created on today | |
pos = PurchaseOrder.all(:deleted => false, :po_date => date) | |
results = "No purchase orders created on #{date}" | |
if pos.size > 0 |
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
# dm modle | |
class SampleOrder | |
include DataMapper::Resource | |
property :id, Serial | |
property :order_no, String | |
... | |
before :save, :set_order_no | |
def set_order_no |
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
before :save, :set_order_no | |
def set_order_no | |
order_no = next_order_no if order_no.nil? || order_no.blank? | |
end | |
private | |
def next_order_no | |
... | |
end |
NewerOlder