Skip to content

Instantly share code, notes, and snippets.

Common Rails Commands

rake db:create

  • Creates all the databases specified in config/database.yml

rake db:migrate

  • Run existing migrations in db/migrate
  • Generates the schema.rb file
import java.util.Scanner;
public class OnTheMoney {
public static void main(String[] args) {
String n;
String lastName;
int denom;
//"denom" will be the variable used for either the $1, $10, or $100
Scanner sc = new Scanner (System.in);
@jshawl
jshawl / app.rb
Created September 27, 2016 19:38
while true
while true
puts "press enter"
input = gets.chomp
break if input != ""
end
puts "you lose"
puts "do you want to play again?"
input = gets.chomp
if input == "no"
import React from 'react'
import ReactDOM from 'react-dom'
class NewItem extends React.Component {
constructor(props){
super()
this.state = props
}
render(){
return <form onSubmit={ e => this.create(e) }>
import React from 'react'
import ReactDOM from 'react-dom'
class GrandParent extends React.Component {
listen(sound){
console.log(sound)
}
render(){
return <div>
<Parent listen={sound => this.listen(sound) }/>
# regular
for i in range(1,101):
if i % 15 == 0:
print "fizzbuzz"
elif i % 3 == 0:
print "fizz"
elif i % 5 == 0:
print "buzz"
else:
@jshawl
jshawl / precess-input-1466110362.scss
Created June 16, 2016 20:52
a precess production
$x: 10px;
.cli{
height:$x;
width:$x;
background:#000;
margin:1em;
box-shadow:
$x 0 0 #fff
,2 * $x 0 0 #fff
,3 * $x 0 0 #fff
#!/usr/bin/env node
var sys = require('sys');
var exec = require('child_process').exec;
var child;
var path = "/var/ww..."
var command = "cd "+ path + "&& touch afile && exit"
function puts(err,stdout,stderr){
<body>
<form method="post" action="<?php $_SERVER['REQUEST_URI'] ?>" >
X= <input type="text" name="x" /> <br />
Y= <input type="text" name="y" /> <br />
Diferença= <select name="expressao">
<option value=">"> > </option>
<option value="<"> < </option>
<option value="="> = </option>
</select>
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
// the banner is inserted at the top of the output
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
},
build: {
src: 'dist/scripts.js',