Though nowhere to be found in the official docs, this works just fine.
describe Facebook::Post do
it_behaves_like :time_series
end
shared_examples_for :time_series do
# shared example code
end
For server-to-server requests to the Facebook Graph API you can skip requesting an Oauth token, an instead use the combination of app_id|app_secret
as your access token. This token will never expire, and should suffice for retrieving basic information from the Graph API.
http://graph.facebook.com/endpoint?key=value&access_token=app_id|app_secret
Since you don't make requests for a certain user, the Graph API might respond with an error in case you're requesting a resource that requires authenticating as a human...
Remove your old LibreOffice:
sudo apt-get remove libreoffice*
You probably also want to get rid of the dead PPAs you might have installed for LibreOffice 4.x:
Installing a new LibreOffice
-------------...
By default git diff
highlights whole lines as changes.
To diff on a word-by-word basis you can say:
git diff --color-words
To diff on a character-by-character basis you can say:
git diff --color-words=.
If you get an error like this:
An error occurred while installing pg (0.17.1), and Bundler cannot continue.
Make sure thatgem install pg -v '0.17.1'
succeeds before bundling.
Then do this:
sudo apt-get install libpq-dev
... and run Bundler again.
It's like Paperclip or CarrierWave, but without any automagic integration.
List flavors to show the ID and name, the amount of memory, the amount of disk space for the root partition and for the ephemeral partition, the swap, and the number of virtual CPUs for each flavor.
$ nova flavor-list
To create a flavor, specify a name, ID, RAM size, disk size, and the number of VCPUs for the flavor, as follows:
$ nova flavor-create FLAVOR_NAME FLAVOR_ID RAM_IN_MB ROOT_DISK_IN_GB NUMBER_OF_VCPUS
The ID of the new flavor should always be one higher than the highest.
How you can unknowingly screw your client's business when all you think about is closing the next user story.
Let's say you have two screens:
Ideally you want both screens to be handled by different controllers like this:
GET /projects/:id => ProjectsController#show
GET /projects/report => Projects::ReportsController#show
What seems like a simple requirement is a little awkward to configure in your routes.
Obviously the report should be a singleton resource, but how can we nest it into the Projects::
namespace?
What does not work is this:
resources :proj...
Sometimes you need complex expectations on method arguments like this
SomeApi.should_receive(:find).with(:query => '*foo*', :sort => 'timestamp ASC', :limit => 100).and_return(['some result'])
This is not very flexible, and failure messages will be hard to read.
Instead, consider doing this:
SomeApi.should_receive(:find) do |params|
params[:query].should == '*foo*'
params[:sort].should == 'timestamp ASC'
params[:limit].should == 100
['some result']
end
PDFKit.new('http://google.com').to_file('google.pdf')
. You can then send the...Talks about some basics of software complexity. Very nice illustrations.
If you want to move an element inside an array, neither JavaScript/ES6+ nor libraries like LoDash offet that natively.
Here is a simple function instead that modifies the input array in place.
function moveArrayElement(array, element, offset) {
const index = array.indexOf(element)
const newIndex = index + offset
if (newIndex > -1 && newIndex < array.length) {
// Remove the element from the array
const removedElement = array.splice(index, 1)[0]
// At "newIndex", remove 0 elements and insert the removed el...
When using jQueryUI's Sortable plugin (either directly or via Angular's ui.sortable), you might struggle testing your nice drag&drop GUI since Selenium webdriver does not support native dragging events.
But jQueryUI uses jquery.simulate
for their testing, so why shouldn't you? There is even an extension to it that makes testing drag & drop quite easy.
Here is what you need:
jquery.simulate.js
Styling HTML email is painful. Tables, inline CSS, unsupported CSS, desktop clients, web clients, mobile clients, various devices, various providers. All these things have to be thought about and tested. It’s no surprise developers don’t want to deal with this when there is a backlog of more important priorities.
We’ve tried to remove some of the pain for you and open-sourced a collection of common templates for transactional email.
Alternative transactional email templates include
Yesterday, Rails fixed a security issue (CVE-2014-3514) in Rails 4+. It was possible to use .where
or .create_with
to bypass Rails' Strong Parameters:
user.blog_posts.create_with(params[:blog_post]).create
would set all attributes on the blog post. After the fix, you have to properly whitelist the params, via `params[:blog_post].permit(:title, :bo...
Nearly all jQuery traversal functions ignore elements that are not HTML tags.
To work with other type of nodes (like text, comment or CDATA sections) you need to:
contents()
(which behaves like children()
except that it returns all types of child nodes)filter()
methodLet's write a function that takes a jQuery element and returns an array of all child nodes that are text nodes:
function selectTextNodes($container) {
retu...
These two addons will change your life:
Search as list
: This will always open search results in the list views instead of the barely usabely faceted search view.
Sort search results by date not relevance
: Does what it says.
Microsoft Exchange service administrators can enable Exchange Web Services (EWS) which is a rather accessible XML API for interacting with Exchange. This allows you to read and send e-mails, create appointments, invite meeting attendees, track responses, manage to-do tasks, check user availability and all other sorts of things that are usually only accessible from Outlook.
You can implement an EWS by hand-rolling your XML (the [docs](http://msdn.microsoft.com/en-us/...
Restmod creates objects that you can use from within Angular to interact with your RESTful API.
require 'net/http'
module Cheat
extend self # the magic ingredient
def host
@host ||= 'http://cheat.errtheblog.com/'
end
def http
@http ||= Net::HTTP.start(URI.parse(host).host)
end
def sheet(name)
http.get("/s/#{name}").body
end
end
# use it
Cheat.sheet 'migrations'
Cheat.sheet 'singletons'
Unfortunately, the hidden emoticons are some of the most expressive and useful ones.
(skype) (ss)
(call)
(talk)
(u) (U)
(o) (O) (time)
(e) (m)
(~) (film) (movie)
(mp) (ph)
(drunk)
(punch)
(smoking) (smoke) (ci)
(toivo)
(rock)
(headbang) (banghead)
(bug)
(poolparty)
(talktothehand)
(idea)
(sheep)
(cat) :3
(bike)
(dog)
The The U.S. Digital Services Playbook is pretty amazing (context).