Skip to content

Instantly share code, notes, and snippets.

View guinslym's full-sized avatar

Guinslym guinslym

View GitHub Profile
@guinslym
guinslym / gist:8233175
Created January 3, 2014 05:16
to append a new form and to change the id
$('#replyForm').append("<%= escape_javascript(render(@newForm)) %>");
$('#newForm').attr('id', 'newid');
@guinslym
guinslym / github_push
Last active January 2, 2016 04:29
github issue. In a folder i have only one file (bonjour.txt). I want to add that file on my github
guinslym@ubuntu:~/Documents/programming/rails_book/rails_3_action/bonjour$ ls -la
total 3
drwxrwxr-x 3 guinslym guinslym 1024 Jan 3 22:01 .
drwxrwxr-x 5 guinslym guinslym 1024 Jan 3 22:00 ..
drwxrwxr-x 8 guinslym guinslym 1024 Jan 3 22:01 .git
-rw-rw-r-- 1 guinslym guinslym 0 Jan 3 22:00 bonjour.txt
guinslym@ubuntu:~/Documents/programming/rails_book/rails_3_action/bonjour$ git remote add origin [email protected]:guinslym/bonjour.git
guinslym@ubuntu:~/Documents/programming/rails_book/rails_3_action/bonjour$ git push origin master -u
Warning: Permanently added the RSA host key for IP address '192.30.252.128' to the list of known hosts.
ERROR: Repository not found.
@guinslym
guinslym / database.yml___original
Last active January 2, 2016 04:29
I have an error while trying to 'git push heroku master' . I have already uploaded my rsa key to heroku. (heroku keys:add ~/.ssh/rsa_name_of_my_key.pub) and I added my key too this key (heroku keys:add). When I did this on the terminal 'port install sqlite3 +universal' I have an error.
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
@guinslym
guinslym / Gemfile
Created January 4, 2014 03:47
for :production in the Gemfile they use gem 'pg', group: :production
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', group: [:development, :test]
gem 'rails_12factor', group: :production
gem 'pg', group: :production
@guinslym
guinslym / _form.html.erb
Created January 4, 2014 11:26
When I click submit on the form. The form doesn't load in the params the value that contains the checkbox. Matter of fact I got an error (Image shape can't be blank) due to the model
<%= form_for @image, html: { multipart: true } do |f| %>
<% if @image.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@image.errors.count, "error") %> prohibited this image from being saved:</h2>
<ul>
<% @image.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
@guinslym
guinslym / terminal
Created January 7, 2014 06:44
I'm trying to do this github tutorial for beginner. https://help.github.com/articles/create-a-repo It's suppose to be simple but I'm getting some errors
guinslym@ubuntu:~/Documents$ mkdir ~/Hello-World
guinslym@ubuntu:~/Documents$ cd ~
guinslym@ubuntu:~$ cd Hello-World/
guinslym@ubuntu:~/Hello-World$ git init
Initialized empty Git repository in /home/guinslym/Hello-World/.git/
guinslym@ubuntu:~/Hello-World$ touch README
guinslym@ubuntu:~/Hello-World$ git add README
guinslym@ubuntu:~/Hello-World$ git commit -m 'first commit'
[master (root-commit) db61432] first commit
1 file changed, 0 insertions(+), 0 deletions(-)
@guinslym
guinslym / gist:8310111
Created January 8, 2014 01:24
I'm want to push a tutorial app to Heroku. I'm running with an error.
guinslym@ubuntu:~/Documents/programming/rails_book/rails_beginner_3/bookmarks$ git push heroku master
The authenticity of host 'heroku.com (50.19.85.132)' can't be established.
RSA key fingerprint is 8b:48:5e:67:[remove by me for protection]:ad.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'heroku.com,50.19.85.132' (RSA) to the list of known hosts.
Initializing repository, done.
Counting objects: 89, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (77/77), done.
Writing objects: 100% (89/89), 75.31 KiB, done.
@guinslym
guinslym / edit.php
Last active January 2, 2016 13:39
database cakephp errors
<div class="configurations form">
<?php echo $this->Form->create('Configuration', array('type' => 'file')); ?>
<fieldset>
<legend><?php echo __('Edit Configuration'); ?></legend>
<?php
echo $this->Form->input('id');
echo $this->Form->input('username');
echo $this->Form->input('profession');
echo $this->Form->input('description', array('type' => 'textarea','label' => 'Content of this Article', 'rows' => '10', 'cols' => '120'));
echo $this->Form->input('userphoto', array('type' => 'file'));
<?php
App::uses('AppController', 'Controller');
/**
* Configurations Controller
*
* @property Configuration $Configuration
* @property PaginatorComponent $Paginator
*/
class ConfigurationsController extends AppController {
@guinslym
guinslym / Configuration.php
Last active January 2, 2016 15:09
I have an error : "The Configuration could not be saved." when I'm uploading a file
<?php
App::uses('AppModel', 'Model');
/**
* Configuration Model
*
*/
class Configuration extends AppModel {
/**
* Display field