This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const gatherChars = str => str | |
.match(/(.)\1*/g) | |
.map(s => `${s.charAt(0)}${s.length}`) | |
.join(''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.factory('foo', ['Restangular', (Restangular) => { | |
return Restangular.one('foo', 1); | |
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git diff-tree --no-commit-id --name-only -r your-branch-name | xargs sed -ie 's/oldName/newName/g' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git for-each-ref --sort=-committerdate refs/heads/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# converts a png image to jpeg | |
# all transparent regions will be converted to white | |
convert -flatten source.png destination.jpg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ThingController < ApplicationController do | |
# ... | |
protected | |
def protected_thing | |
'foo' | |
end | |
private | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Example</title> | |
</head> | |
<body> | |
<h1>Example</h1> | |
<section> | |
<!-- | |
I want to display these numbers in two columns like so: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('myModule', []) | |
.directive('myDirective', myDirective); | |
function myDirective () { | |
return { | |
restrict: 'E', | |
scope: { | |
inputName: '@', | |
model: '=' | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
<section class="header"> | |
<h1>My Page</h1> | |
</section> | |
<article class="content"> | |
<h2>The things I am putting on the internet</h2> | |
<p>Jack swab salmagundi Brethren of the Coast knave line plunder belaying pin Admiral of the Black boom. Sloop pink holystone yard pillage tender no prey, no pay Pirate Round chandler bilge water. Transom careen rum keelhaul lanyard man-of-war rope's end grog pinnace bucko.</p> | |
<p>Bilged on her anchor chase Jolly Roger coffer jury mast rum grapple interloper hearties keel. Avast chantey Jolly Roger fathom scallywag matey Spanish Main booty Corsair Plate Fleet. Fluke Buccaneer cog yo-ho-ho spirits loaded to the gunwalls pillage gunwalls gally holystone.</p> | |
<p>League stern maroon quarter fore jack grog blossom American Main clipper pressgang. Ho tack landlubber or just lubber run a shot across the bow grapple boom cutlass long clothes hands reef. Jack Tar Buccaneer Sail ho aye spyglass run a rig Brethren of the Coast carouser parrel landlubber or just |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# let's say I want to execute a callback before making a FactoryGirl fixture using #create | |
factory :thing do | |
before(:create) do |foo| | |
foo.bar = create :baz | |
end | |
end | |
# but then I also want to call the same block after making a FactoryGirl fixture using #build | |
factory :thing do | |
before(:create) do |foo| |