Skip to content

Instantly share code, notes, and snippets.

View angelxmoreno's full-sized avatar

Angel S. Moreno angelxmoreno

View GitHub Profile
letters_correct = []
letters_incorrect = []
# 1. Print out game instructions for player 1 and player 2
puts "Welcome to hang man..."
# 2. Player one chooses a word
puts "Player 1 enter a word"
# word2guess = gets.chomp
word2guess = "box"
# 1. Print out game instructions for player 1 and player 2
# 2. Player one chooses a word
# 3. Display the amount of characters in the word as underscores
# 4. Player 2 enters a letter
# 5. Check if the letter player 2 entered is in the word player 1 chose
# 1. tell the user the game they are playing
puts "Hello Player. You are about to start the RPX."
# 2. CPU picks R or P or S
possible_choices = ["rocks", "paper", "scissors"]
cpu_move = possible_choices.sample
# 3. The player picks between "rocks", "paper", "scissors"
puts "Choose between rocks, paper, scissors"
@angelxmoreno
angelxmoreno / pouchdb-upsert-examples.js
Created December 8, 2015 17:07
Examples on using pouchdb upsert plugin
var newDoc = {
_id: 'user/123',
name: 'John Conner',
dob: 'February 28, 1985',
rank: 'Annnoying teenage hacker'
};
db.upsert(newDoc._id, function(doc){
//this time around doc == {}
return newDoc;
@angelxmoreno
angelxmoreno / event.abstract.js
Created October 29, 2015 15:05
Extending Sequelize models
/* global sequelize, module */
//event.abstract.js
module.exports = function (sequelize, DataTypes) {
var schema = {
title: {
type: DataTypes.STRING,
allowNull: false
},
body: {
api-shopmobi@0.0.0 /Users/amoreno/Projects/ShopMobi/api-shopmobi
├── bcryptjs@2.3.0
├── bluebird@2.10.2
├─┬ body-parser@1.14.1
│ ├── bytes@2.1.0
│ ├── content-type@1.0.1
│ ├─┬ debug@2.2.0
│ │ └── ms@0.7.1
│ ├── depd@1.1.0
│ ├─┬ http-errors@1.3.1
Install Java
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
sudo aptitude -y install oracle-java8-installer
java -version
Install ElasticSearch
wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.6.0.deb
<ul>
<li>
<a id="google" href="http://google.com" class="red-ligting">Google</a>
</li>
<li>
<a id="yahoo" href="http://yahoo.com">Yahoo</a>
</li>
<li>
<a id="bing" href="http://bing.com">Bing</a>
</li>
// routes.php
<?php
Router::parseExtensions('json', 'xml');
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
CakePlugin::routes();
require CAKE . 'Config' . DS . 'routes.php';
?>
// AppController
<?php
class Keyword extends MoviesAppModel {
public function __construct($id = false, $table = null, $ds = null) {
parent::__construct($id, $table, $ds);
$this->virtualFields['movies_count'] = sprintf(
'select count(*) from `keywords_movies` where `keywords_movies`.`keyword_id` = `%s`.`id', $this->alias
);
}
?>