Skip to content

Instantly share code, notes, and snippets.

@markgoodyear
markgoodyear / run-current-sim.js
Created August 28, 2018 16:06
Runs react-native run-ios to the current open simulator
const child_process = require('child_process');
const runOnCurrentSim = () => {
try {
const simulators = JSON.parse(
child_process.execFileSync(
'xcrun',
['simctl', 'list', '--json', 'devices'],
{encoding: 'utf8'},
),
@markgoodyear
markgoodyear / rn-i18n-locale-identifiers.csv
Created April 3, 2018 16:25 — forked from ndbroadbent/rn-i18n-locale-identifiers.csv
React Native i18n Locale Identifiers
Locale Identifier Description
af Afrikaans
af-NA Afrikaans (Namibia)
af-ZA Afrikaans (South Africa)
agq Aghem
agq-CM Aghem (Cameroon)
ak Akan
ak-GH Akan (Ghana)
am Amharic
am-ET Amharic (Ethiopia)
@markgoodyear
markgoodyear / SassMeister-input.scss
Created November 24, 2015 10:54
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
@mixin headings($from: 1, $to: 6) {
%headings-#{$from}-#{$to} {
@content
}
@if $from >= 1 and $to <= 6 {
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var bower = require('main-bower-files');
gulp.task('bower', function () {
return gulp.src(bower())
.pipe(concat('vendor.js'))
.pipe(uglify())
.pipe(gulp.dest('/build/scripts'));
@markgoodyear
markgoodyear / noRepeat.js
Created July 28, 2015 10:06
Swap `background-repeat: none` to `background-repeat: no-repeat`: https://twitter.com/hugogiraudel/status/625966606351495168
var noRepeat = function () {
return function (css) {
css.eachDecl('background-repeat', function (decl) {
if (decl.value.indexOf('none') !== -1) {
decl.value = 'no-repeat';
}
});
};
};
{
onStick: function () {
document.querySelector('.img-elem').src = '/path/to/stick-img.png'
},
onUnstick: function () {
document.querySelector('.img-elem').src = '/path/to/unstick-img.png'
},
}
{# Get the IDs of all the sections #}
{% set currentSectionId = entry.id %}
{% set allSectionIds = craft.entries.section('myStructure').level(1).ids() %}
{# Define var before loop #}
{% set sectionNumber = '' %}
{# Loop through all section IDs and find the one that matches the current #}
{% for key, sectionId in allSectionIds if sectionId == currentSectionId %}
@markgoodyear
markgoodyear / SassMeister-input-HTML.html
Created November 27, 2014 10:41
Generated by SassMeister.com.
<p>Normal</p>
<a class="btn btn--primary">Button</a>
<a class="btn btn--primary btn--outline">Button</a>
<a class="btn btn--secondary">Button</a>
<a class="btn btn--secondary btn--outline">Button</a>
<a class="btn btn--tertiary">Button</a>
<a class="btn btn--tertiary btn--outline">Button</a>
@markgoodyear
markgoodyear / SassMeister-input-HTML.html
Created November 26, 2014 22:56
Generated by SassMeister.com.
<p>Normal</p>
<a class="btn btn--primary">Button</a>
<a class="btn btn--primary btn--outline">Button</a>
<a class="btn btn--secondary">Button</a>
<a class="btn btn--secondary btn--outline">Button</a>
<a class="btn btn--tertiary">Button</a>
<a class="btn btn--tertiary btn--outline">Button</a>
function extend (target, source) {
var a = Object.create(target);
Object.keys(source).map(function (prop) {
a[prop] = source[prop];
});
return a;
};