Skip to content

Instantly share code, notes, and snippets.

@begin29
begin29 / 0_reuse_code.js
Last active November 8, 2016 07:21
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
=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 / rebase.sh
Created December 2, 2015 19:18
How to fix pull request?
# I am working on new feature
$ git checkout -b some-new-feature
#Changed files, commit and push to source
git add . && git commit -m 'some cool changes' && git push origin some-new-feature
#After comments within pull request I need to fix some code
#After fix it and commit I can see 2 commits within git history
$ git add . && git commit -m 'some fix to cool changes' && git push origin some-new-feature
$ git log
@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')