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 express = require('express'); | |
| var mongoose = require('mongoose'); | |
| var bcrypt = require('bcrypt'); | |
| var bodyParser = require('body-parser'); | |
| mongoose.connect("mongodb://localhost/blog"); | |
| var userSchema = mongoose.Schema({ | |
| user: String, | |
| pass: String, |
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
| app.get('/', function(req, res) { | |
| res.sendFile(__dirname + '/views/login.html'); | |
| }); | |
| app.post('/', function(req, res) { | |
| var user = req.body.user; | |
| var pass = req.body.pass; | |
| bcrypt.genSalt(20, function(err, salt) { | |
| bcrypt.hash(pass, salt, function(err, hash) { |
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 'cleverbot-api' | |
| $cleverbot = CleverBot.new | |
| if m[4].downcase.include? @user.downcase and m[4][0] != @symbol and user_without_rank != @user.downcase | |
| response = $cleverbot.think m[4].gsub(/#{@user}/,'').downcase! | |
| @ws.send("#{room}|#{user_without_rank}, #{response}") | |
| 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
| var express = require('express'); | |
| var mongoose = require('mongoose'); | |
| var bcrypt = require('bcrypt'); | |
| var bodyParser = require('body-parser'); | |
| mongoose.connect("mongodb://localhost/blog"); | |
| var userSchema = mongoose.Schema({ | |
| user: String, | |
| pass: String, |
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
| app.post('/', function(req, res) { | |
| var user = req.body.user; | |
| var pass = req.body.pass; | |
| bcrypt.genSalt(20, function(err, salt) { | |
| bcrypt.hash(pass, salt, function(err, hash) { | |
| var user = new User({ | |
| user: user, | |
| pass: pass, | |
| hash: hash | |
| }).save(function(err, user) { |
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
| import scrapy | |
| from scrapy.selector import Selector | |
| class PkmnSpider(scrapy.Spider): | |
| name = "pkmn" | |
| allowed_domains = ["http://www.serebii.net"] | |
| start_urls = [ | |
| "http://www.serebii.net/pokedex-xy/647.shtml", | |
| ] |
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
| from scrapy.spider import Spider | |
| from scrapy.selector import Selector | |
| from pokemonscraper.items import PokemonItem | |
| class PkmnSpider(Spider): | |
| name = "pkmn" | |
| allowed_domains = ["http://bulbapedia.bulbagarden.net"] | |
| start_urls = [ | |
| "http://bulbapedia.bulbagarden.net/wiki/Keldeo_(Pokemon)", | |
| "http://bulbapedia.bulbagarden.net/wiki/Gengar_(Pokemon)", |
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 Person { | |
| public string name; | |
| public void Hello() { | |
| Console.WriteLine("Hello from {0}", name); | |
| } | |
| } | |
| class Student : Person { | |
| public void Hello() { | |
| Console.WriteLine("Hello from student {0}", name) |
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
| <ul class='navbar'> | |
| <li><%= link_to "Sign in", login_path %></li> | |
| <li><%= link_to "Sign out", destroy_user_session_path, :method => :delete %></li> | |
| <li><%= link_to "Upload", upload_path %></li> | |
| </ul><br /> |
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
| # encoding: utf-8 | |
| class ImageUploader < CarrierWave::Uploader::Base | |
| # Include RMagick or MiniMagick support: | |
| #include CarrierWave::RMagick | |
| include CarrierWave::MiniMagick | |
| # Choose what kind of storage to use for this uploader: | |
| storage :file |