Skip to content

Instantly share code, notes, and snippets.

View 01-gulpfile.js
/*!
* gulp
* $ npm install gulp-ruby-sass gulp-autoprefixer gulp-cssnano gulp-jshint gulp-concat gulp-uglify gulp-imagemin gulp-notify gulp-rename gulp-livereload gulp-cache del --save-dev
*/
// Load plugins
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
cssnano = require('gulp-cssnano'),
View scroll.easing.js
function scrollTo(Y, duration, easingFunction, callback) {
var start = Date.now(),
elem = document.documentElement.scrollTop?document.documentElement:document.body,
from = elem.scrollTop;
if(from === Y) {
callback();
return; /* Prevent scrolling to the Y point if already there */
}
@markgoodyear
markgoodyear / run-current-sim.js
Created Aug 28, 2018
Runs react-native run-ios to the current open simulator
View run-current-sim.js
const child_process = require('child_process');
const runOnCurrentSim = () => {
try {
const simulators = JSON.parse(
child_process.execFileSync(
'xcrun',
['simctl', 'list', '--json', 'devices'],
{encoding: 'utf8'},
),
View rn-i18n-locale-identifiers.csv
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)
View gulp-bower.js
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 / task.js
Created Oct 11, 2014
Concat all modules first in Angular
View task.js
var paths = {
src: [
'src/scripts/app/**/*module*.js',
'src/scripts/app/**/*.js'
],
dest: 'app/assets/scripts'
};
gulp.task('scripts', function () {
View clean.js
// Styles
gulp.task('styles', function() {
return gulp.src(config.sources.styles)
.pipe(sass({ errLogToConsole: true, outputStyle: 'expanded' }))
.pipe(prefix('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
.pipe(gulpif(isProduction, mincss({ keepSpecialComments: 0 })))
.pipe(header(banner))
.pipe(gulp.dest(config.output.styles))
.pipe(reload(server));
});
@markgoodyear
markgoodyear / SassMeister-input.scss
Created Nov 24, 2015
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// libsass (v3.2.5)
// ----
@mixin headings($from: 1, $to: 6) {
%headings-#{$from}-#{$to} {
@content
}
@if $from >= 1 and $to <= 6 {
@markgoodyear
markgoodyear / noRepeat.js
Created Jul 28, 2015
Swap `background-repeat: none` to `background-repeat: no-repeat`: https://twitter.com/hugogiraudel/status/625966606351495168
View noRepeat.js
var noRepeat = function () {
return function (css) {
css.eachDecl('background-repeat', function (decl) {
if (decl.value.indexOf('none') !== -1) {
decl.value = 'no-repeat';
}
});
};
};
View headhesive-swap-image.js
{
onStick: function () {
document.querySelector('.img-elem').src = '/path/to/stick-img.png'
},
onUnstick: function () {
document.querySelector('.img-elem').src = '/path/to/unstick-img.png'
},
}
You can’t perform that action at this time.