Skip to content

Instantly share code, notes, and snippets.

@samgooi4189
samgooi4189 / gist:8044635
Created December 19, 2013 19:19
hudson.security.AccessDeniedException2: anonymous is missing the Overall/Read permission
One may accidentally set up security realm / authorization in such a way that you may no longer able to reconfigure Jenkins.
When this happens, you can fix this by the following steps:
Stop Jenkins (the easiest way to do this is to kill the servlet container.)
Go to $JENKINS_HOME in the file system and find config.xml file.
Open this file in the editor.
Look for the <useSecurity>true</useSecurity> element in this file.
Replace true with false
Remove the elements authorizationStrategy and securityRealm
@samgooi4189
samgooi4189 / Dynamic yml test set
Created January 7, 2014 07:10
Tips for dynamic generated test yml
To save time from repeatedly typing the same dataset with little difference, it is better to use erb script to help the process. By using the erb script, you can generate a lot of data using just a few lines of code.
Here is common troubleshooting:
a. The file extension will still be .yml, not .erb .
b. When you write your script, prevent the use of <tab>.
Enjoy and get back to work.
@samgooi4189
samgooi4189 / gist:8486270
Created January 18, 2014 04:33
routes for sample api_engine
RailsGuide::Application.routes.draw do
resources :posts
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
root to: 'posts#index'
@samgooi4189
samgooi4189 / gist:8494776
Created January 18, 2014 19:07
controller for angular
'use strict';
/* Controllers */
angular.module('myApp.controllers', [])
.controller('MyCtrl1', [function($scope, $http) {
$http.get('localhost:3000/posts/1.json').success(function(data){
$scope.posts = data;
});
}])
@samgooi4189
samgooi4189 / JS_piktochart
Created June 26, 2014 01:15
Piktochart project
JAVASCRIPT
I would like to let you know that most people go through a Javascript test which will have to be very well commented on (with proper indentations and follow strictly the descriptions as following). You will have 7 days to take the test and pass it back to us.
Basic Requirement:
- Build a chart with custom icons
- Build an editor to accommodate the chart
@samgooi4189
samgooi4189 / rails_model_naming
Created July 10, 2014 06:25
Rails naming convention
if you get error message:
undefined method `equipment_index_path'
you are probably violated the pluralize convention when naming the model.
For next time, please launch rails c, then use '[Enter word here]'.pluralize to make sure the word fits the convention.
@samgooi4189
samgooi4189 / falseIsBlank
Created July 18, 2014 06:58
Paasing false in hidden field will get validation error
After wondering why I can't pass my model validation after assigning false boolean,
I run some test in console.
I found out that the value false is equivalent to blank. So if you set your model to validate presence, you will get error when you pass false into your input field.
@samgooi4189
samgooi4189 / Nginx and Passenger SSL
Created August 20, 2014 02:18
[Solution] Nginx and Passenger running but Rails is not up
After configure Nginx and Passenger correctly, you should check on config/environments/production.rb to make sure that force-ssl is false. If you tend to use SSl for your application, you will be using port 443 and required to buy SSL certificate from vendors.
@samgooi4189
samgooi4189 / Nginx, Passenger, Rails
Created August 20, 2014 08:31
Setting up Nginx with Passenger with Rails 4
Taken from: http://alexbachuk.com/launch-rails-4-application-with-passenger-and-nginx/
ssh root@111.111.1.111 SSH as root, using IP address and password you get by email
adduser alex Create new username, because using root is not recommended.
visudo Open sudo config file and add admin privileges to newly created user.
alex ALL=(ALL) ALL) add this and ctrl+x to save ‘y’ and enter to overwrite
sudo apt-get update update system packages
curl -L get.rvm.io | bash -s stable install ruby version manager
source ~/.rvm/scripts/rvm load RVM
rvm requirements install all RVM dependencies
@samgooi4189
samgooi4189 / GRUB2 fix
Created October 1, 2014 15:13
repair grub2
boot live cd
sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair
boot-repair