Skip to content

Instantly share code, notes, and snippets.

=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@begin29
begin29 / 0_reuse_code.js
Last active August 29, 2015 14:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
App.ProfilePhotoView = Ember.View.extend({
click: function(evt) {
this.get('controller').send('expandProfilePhoto');
}
});
App.UserController = Ember.ObjectController.extend({
actions: {
expandProfilePhoto: function() {
// Get the expanded picture and display it
@begin29
begin29 / online_libraries.html
Created June 4, 2015 11:53
#EmberJs online libraries for jsbin.com
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.js"></script>
<script src="http://builds.emberjs.com.s3.amazonaws.com/tags/v1.0.0/ember.js"></script>
#Alternate to merge
git checkout feature
git rebase master
#Smash last 2 commits
git rebase -i HEAD~2
#Conflicts?
#resolve conflicts
git add (conflict files)
@begin29
begin29 / extend.js
Created November 30, 2015 15:11
extend class in JS
function BaseClass()
{
this._map = {};
};
BaseClass.prototype.parseXML = function( key, value )
{
alert("BaseClass::parseXML()");
this._map[key] = value;
}
@begin29
begin29 / fetch changes.sh
Created December 2, 2015 19:32
How to get new changes from origin repository
# Make sure you have 2 origins (your forked project and project from which you forked)
$ git remote -v
# origin git@github.com:a-LERT/schoolTest.git (fetch)
# origin git@github.com:a-LERT/schoolTest.git (push)
# upstream git@github.com:begin29/schoolTest.git (fetch)
# upstream git@github.com:begin29/schoolTest.git (push)
# If you have only one add it
$ git remote add upstream git@github.com:begin29/schoolTest.git
@begin29
begin29 / share_from_dropbox.rb
Created March 14, 2016 14:31
share file from dropbox
require 'dropbox_sdk'
APP_KEY = 'some key'
APP_SECRET = 'some secret key'
client = DropboxClient.new(APP_SECRET)
client.media('path_file') # if file is placed in root then client.media('some_name.jpg')
@begin29
begin29 / apply.js
Created March 16, 2016 15:29
JavaScript apply()
window.name = 'окошко';
var test = function () { alert(this.name); }
var obj = {
name: 'объектик',
fx: function() {
test();//->окошко, т.к. функция объявлена в контексте window
test.apply(this);//->объектик, т.к. мы вызвали функцию в нужном нам контексте
}
}
@begin29
begin29 / linux_fs.sh
Last active May 3, 2016 11:39
Linux file system
#apache logs
/var/log/apache2/access.log - records of every page served and every file loaded by the web server.
/var/log/apache2/error.log - records of all error conditions reported by the HTTP server