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
var MongoClient = require('mongodb').MongoClient | |
, assert = rsuequire('assert'); | |
// Connection URL | |
var url = 'mongodb://localhost:27017/myproject'; | |
// Use connect method to connect to the server | |
MongoClient.connect(url, function(err, db) { | |
assert.equal(null, err); | |
console.log("Connected successfully to server"); |
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
var TodoItem=React.createClass({ | |
render:function(){ | |
return (<li className="list-group-item "> <div className="row"><div className="col-xs-8">{this.props.pos} {this.props.title}</div><div className="col-xs-2"> <button type="button" className="btn btn-danger " onClick={this.deleteMe} >X Delete</button></div></div></li>); | |
}, | |
deleteMe:function(){ | |
console.log("Delete"); | |
} | |
}) | |
var TodoList=React.createClass({ |
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
var Counter=React.createClass({ | |
render:function(){ | |
return (<div></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
var HelloWorld=React.createClass({ | |
render:function(){ | |
return React.createElement("div",{"className":"bright",id:"gello"},"HelloWorld"); | |
} | |
}); | |
ReactDOM.render(React.createElement(HelloWorld,null), document.getElementById("app")); |
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
{ | |
"staging":{ | |
"uploadPath":"/reactcode" | |
}, | |
"uat":{ | |
"uploadPath":"/reactcodeuat" | |
}, | |
"production":{ | |
"dangerous":true, | |
"uploadPath":"/reactcodelive" |
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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
# Description: starts nginx using start-stop-daemon |
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
= form_for(@<%= singular_table_name %>, html: { class: "form-horizontal", role: "form" }) do |f| | |
- if @<%= singular_table_name %>.errors.any? | |
.alert.alert-danger.alert-dismissable role="alert" | |
button.close type="button" data-dismiss="alert" | |
span aria-hidden="true" | |
| × | |
span.sr-only | |
| Close | |
h4= "#{pluralize(@<%= singular_table_name %>.errors.count,"error")} prohibited this <%= singular_table_name %> from being saved:" | |
ul |
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 | |
class Database{ | |
static private $_instance; | |
static $hostname=""; | |
static $username=""; | |
static $password=""; | |
static $database=""; | |
$conn; | |
static function getInstance(){ | |
if(self::$_instance) |
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 Item < ActiveRecord::Base | |
attr_accessible :name, :price, :priority,:picture,:url | |
belongs_to :user | |
validates :name, presence: true | |
validates :price, presence: true | |
validates :price, length: { :maximum => 7} | |
has_attached_file :picture,:styles => {:small => "100x100>"} | |
validates_attachment_size :picture, :less_than => 5.megabytes | |
validates :url, format: /(^$)|(^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$)/ix | |
validates_attachment_content_type :picture, :content_type => ['image/jpeg', 'image/png'] |