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 'sinatra' | |
require 'dm-core' | |
require 'haml' | |
DataMapper.setup(:default, 'sqlite3::memory:') | |
class Message | |
include DataMapper::Resource | |
property :id, Serial |
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
/* | |
I created the following javascript to use bootstrapt's notifications through Javascript. | |
If you like it you may consider adding it to bootstrapt. Feel free to modify if necessary. | |
Be sure you define a div #notification-area, where the notifications are going to be displayed by default. | |
I use it with jQuery 1.7.1 but it should work with older versions. Is also use jquery.hotkeys.js ( https://github.com/jeresig/jquery.hotkeys ) for block messages hotkeys | |
*/ | |
(function( $ ){ | |
var pub = { |
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
<?php | |
// get all urls from the home page that are | |
$html = file_get_contents('http://www.catwalkyourself.com'); | |
$dom = new DOMDocument(); | |
@$dom->loadHTML($html); | |
// grab all the on the page | |
$xpath = new DOMXPath($dom); |
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 Clients_Controller extends Base_Controller { | |
public $restful = true; | |
public function get_index() | |
{ | |
return Response::eloquent(Client::find(1)); | |
} | |
} |
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
/* | |
| ------------------------------------------------------------------- | |
| Schedule and update fashion news with the news rss feed | |
| ------------------------------------------------------------------- | |
| | |
| */ | |
add_action('init', function(){ | |
$timescheduled = wp_next_scheduled('update_feed'); | |
wp_unschedule_event($timescheduled, 'update_feed'); |
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
# | |
# Mac OS X / Mac OS X Server | |
# The <IfDefine> blocks segregate server-specific directives | |
# and also directives that only apply when Web Sharing or | |
# server Web Service (as opposed to other services that need Apache) is on. | |
# The launchd plist sets appropriate Define parameters. | |
# Generally, desktop has no vhosts and server does; server has added modules, | |
# custom virtual hosts are only activated when Web Service is on, and | |
# default document root and personal web sites at ~username are only | |
# activated when Web Sharing is on. |
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
# | |
# Virtual Hosts | |
# | |
# If you want to maintain multiple domains/hostnames on your | |
# machine you can setup VirtualHost containers for them. Most configurations | |
# use only name-based virtual hosts so the server doesn't need to worry about | |
# IP addresses. This is indicated by the asterisks in the directives below. | |
# | |
# Please see the documentation at | |
# <URL:http://httpd.apache.org/docs/2.2/vhosts/> |
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 'forwardable' | |
class User | |
extend Forwardable | |
attr_accessor :view_delegate_class, :first_name, :last_name | |
def_delegators :view_delegate, :full_name | |
def initialize(first_name, last_name) | |
@first_name = first_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
I have a client class | |
```` | |
class Client < ActiveRecord::Base | |
attr_accessible :name, :notetag | |
has_many :profile_datum | |
end | |
```` | |
..and a ProfileDatum class |
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 GearController < ApplicationController | |
before_filter :find_gear | |
private | |
def find_gear | |
@gear = Gear.type(params[:type].to_s.singularize).where(:reference => params[:id]).first if params[:id] | |
end | |
end |
OlderNewer