Skip to content

Instantly share code, notes, and snippets.

Undefined method for nil:NilClass

Simone Vittori simonewebdesign

Undefined method for nil:NilClass
Block or report user

Report or block simonewebdesign

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
simonewebdesign / snake.p8
Created Jul 25, 2019
Snake in PICO-8 — work in progress
View snake.p8
pico-8 cartridge //
version 16
simonewebdesign / example.scss
Last active Jun 18, 2019
Single line text ellipsis truncation SCSS Mixin
View example.scss
.my-class {
@include single-line-truncate;
simonewebdesign /
Last active Jan 23, 2019
Easy Search & Replace on an entire file (or STDIN) using sed

Even better is probably to have a file which looks like this (same thing but more readable):

sed "s/FNAME/Simone/g;\

Just chmod +x and then use it like:

simonewebdesign /
Last active Oct 9, 2018
Add one or more labels to a GitHub pull request or issue, using GitHub API
# This program adds one or more labels to a GitHub issue/PR
curl -s$owner/$repo/issues/$issue_or_pr_number/labels \
simonewebdesign / index.js
Created Jun 5, 2018
JavaScript Array.toSentence - inspired by Ruby's Array#to_sentence
View index.js
// Transforms an array into a sentence.
// Example:
// toSentence(['apples', 'oranges', 'melons']);
// >> "apples, oranges and melons."
export function toSentence(arr) {
if (arr.length === 0) return '';
return arr.length > 1
? `${arr.slice(0, arr.length - 1).join(', ')} and ${arr.slice(-1)}.`
: `${arr[0]}.`;
simonewebdesign / debugging.scss
Last active Nov 8, 2018
Useful CSS snippet for debugging layouts
View debugging.scss
* {
background-color: rgba(0,0,0,.1);
+ * {
background-color: rgba(255,0,0,.1);
+ * {
background-color: rgba(0,255,0,.1);
+ * {
simonewebdesign / index.js
Created Mar 14, 2018
JSON API: Camelize keys in the client (JavaScript) - functional style
View index.js
// Converts 'foo-bar' to 'fooBar'
// Credits:
export function camelize(str) {
return str.replace(/-([a-z])/g, g => g[1].toUpperCase());
function camelizeKeys(obj) {
return Object.assign(...Object.entries(obj).map(
([key, val]) => ({ [camelize(key)]: val })
simonewebdesign / test.js
Created Dec 19, 2017
React PropTypes as mocha unit test errors
View test.js
// Override console.error to run tests
const _console_error = console.error;
console.error = function (msg) {
if (/^Warning: Failed prop type:/.test(msg)) {
it('should pass PropType validation', () => {
throw new AssertionError(msg);
// Call the real console.error
return _console_error.apply(console, arguments);
simonewebdesign / main.js
Created Sep 25, 2017
Useful JS functions: camelize and parameterize
View main.js
// Converts 'foo-bar' to 'fooBar'
// Credits:
export function camelize(str) {
return str.replace(/-([a-z])/g, g => g[1].toUpperCase());
// Converts 'fooBar' to 'foo-bar'
// Credits:
export function parameterize(str) {
simonewebdesign /
Created Aug 31, 2017
Fish shell function to open a pull request on BitBucket
# fill the dots with proper information
function open_pr
set commit_info (git log -1 --pretty=%B)
set title (echo $commit_info | sed -n '1p')
set description (echo $commit_info | tail -n +3 | sed -E ':a;N;$!ba;s/\r{0,1}\n/ \\n/g')
set source_branch (git rev-parse --abbrev-ref HEAD)
set destination_branch develop
set repo_full_name "foo/bar"
set reviewers "[ { \"username\": \"someusername\" }, ... ]"
You can’t perform that action at this time.