Skip to content

Instantly share code, notes, and snippets.

View wbobeirne's full-sized avatar

Will O'Beirne wbobeirne

View GitHub Profile
<?php
/**
* Copy the data from one field to another, and delete the old field.
*/
function merge_fields($old_field, $new_field, $entity_type = '', $bundle = '') {
$prefixes = array(
'field_data_',
'field_revision_',
);
# Provides functions that help with scrolling
# -----------------------------------------------------------------------------
Ok.ScrollHelpers = {
# Check if an element has a scrollbar.
checkScroll: (element, dir) ->
if dir == 'horizontal'
# Half pixels on innerWidth get rounded down. Better way to handle this?
return element.prop('scrollWidth') > (element.innerWidth() + 1)
else
return element.prop('scrollHeight') > element.innerHeight()
.wrapper-main {
max-width: 660px;
width: 100%;
margin: auto;
}
.container {
width: 100%;
/* You have to remove width: 40em; */
}
a,
a:link,
a:visited {
color: #4c7bd9;
text-decoration: none;
}
a:hover,
a:active {
color: #9dbaf2;
}
### Keybase proof
I hereby claim:
* I am wbobeirne on github.
* I am willo (https://keybase.io/willo) on keybase.
* I have a public key whose fingerprint is 253A 48ED CDA1 3280 B4FF EC0F 8292 7AEC 03A2 CC97
To claim this, I am signing this object:
@wbobeirne
wbobeirne / SassMeister-input.scss
Created April 15, 2015 14:05
Generated by SassMeister.com.
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
@function hub-px($px) {
@return #{$px / 12.8}vw;
}
.thing {
const fs = require("fs");
module.exports = (args) => {
return (data) => {
let json = null;
// Include the JSON, throw a log and exit if it wasn't JSON / bad path.
try {
json = require(args.path);
if (!json || json.constructor != Object) {

When starting a new project with a Postgres database, you'll want to do the following things to set it up:

1) Create the Database

Depending on which operating system you're on, you'll need to do the following:

OSX

  1. Open your terminal
  2. Run psql --username=postgres, enter the password you made for postgres

_.map

Pretty much identical IMO.

// Lodash
const listOfAttrs = _.map(listOfObjects, (obj) => obj.attr);

// JS
const listOfAttrs = listOfObjects.map((obj) => obj.attr);
@wbobeirne
wbobeirne / gist:b38ddb50a64626112eec13d82508a43d
Created January 11, 2018 23:10
Kovan Faucet Verification
0xdbbf1a39bf68a269ce4fe6fd24299afb94df86e6