Create browser bookmark in Alfred

03/02/16  Public, Shortcuts

https://youtu.be/O2i_w-57_XA?t=7m54s

To create a new bookmark:

  1. Open the Alfred search window
  2. Paste in the URL of the bookmark
  3. Once you can tell it has been recognized as a website, hit enter

To use...

1 vote - harrylevine

Passing a block into a method, as a parameter - Using Proc and &block

02/23/16  Public, Ruby General

In order to pass a block into a method, as a parameter:

  1. Create a Proc and put the block's contents inside of it
  2. Pass the Proc in as parameter, placing an & in front of the variable's name
  3. In the method, the block parameter will...

1 vote - harrylevine

Link one JavaScript file to another in Rails - Use function in one.js inside of two.js

01/20/16  Public, Other Languages

In Rails, this is to place your JS code in more than one file, based on functionality, to keep things DRY, and to prevent one file from becoming large and complicated.

If you want to call a function from one.js in files two.js and `three.js...

1 vote - harrylevine

JavaScript - Remove all non-alphanumeric characters, new lines, and multiple white space from string

12/27/15  Public, Other Languages

Here is the Regular Expression: /[\W_]+/g

For example:

var str = "234&^%,Me,2 2013 1080p x264 5 1 BluRay!@#$%&*()_-+=";

var filtered = str.replace(/[\W_]+/g, '');

console.log(filtered);
==>  "234Me220131080px26451BluR...

1 vote - harrylevine

JavaScript libraries

12/15/15  Public, Other Languages

https://lodash.com/
- A JavaScript utility library delivering consistency, modularity, performance, & extras.

http://momentjs.com/
- Parse, validate, manipulate, and display dates in JavaScript.

http://underscorejs.org/
- Underscore is a ...

1 vote - harrylevine

Ruby Case statement (aka Switch statement)

11/20/15  Public, Ruby General

Standard Case

print "Enter your grade: "
grade = gets.chomp
case grade
when "A"
  puts 'Well done!'
when "B"
  puts 'Try harder!'
when "C"
  puts 'You need help!!!'
else
  puts "You just making it up!"
end

Mult...

1 vote - harrylevine

Sharing your GitHub SSH public key

10/16/15  Public, Git

Check if you have an SSH key by calling $ ls -al ~/.ssh. If you have these in there:

id_rsa
id_rsa.pub

Then continue on. If not, follow the steps in the link at the bottom of the page.

1 - In your terminal, go to the root ...

1 vote - harrylevine

How to show & hide hidden dot (.) files in the Mac Finder window

10/15/15  Public, Command Line

1 - In Terminal, enter $ defaults write com.apple.finder AppleShowAllFiles YES
2 - Press return
3 - Hold the ‘Option/alt’ key, then right click on the Finder icon in the dock and click Relaunch.

To hide them, repeat the above steps, expect ...

1 vote - harrylevine

Change remote Git URL after forking a repository

10/13/15  Public, Git

After you have forked and cloned the repository:

$ cd into-the-repository
$ git remote set-url origin https://github.com/username/repo-name.git

So for example, if your GitHub username is hpjaj, and the repo is holo-alfa, h...

1 vote - harrylevine

How the ruby Tap method works

10/09/15  Public, Ruby General

First, let's define a couple of terms: caller and mutated.

The caller is what tap is being called on. In the below, the caller is arr:

arr = [2, 3, 1]
arr.tap do |x|
  x.sort
end

Mutated permanently change...

1 vote - harrylevine