Skip to content

Instantly share code, notes, and snippets.

@keeprock
keeprock / DbHelper.php
Created April 15, 2016 11:37 — forked from agarzon/DbHelper.php
Codeception DB helper to extend database functionalities (update & delete)
<?php
namespace Codeception\Module;
/**
* Additional methods for DB module
*
* Save this file as DbHelper.php in _support folder
* Enable DbHelper in your suite.yml file
* Execute `codeception build` to integrate this class in your codeception
*/
@keeprock
keeprock / applescript.scpt
Created March 23, 2016 14:25
Open current Finder folder in iTerm2 version 3 beta
on run {input, parameters}
tell application "Finder"
set dir_path to quoted form of (POSIX path of (folder of the front window as alias))
end tell
CD_to(dir_path)
end run
on CD_to(theDir)
tell application "iTerm"
activate
@keeprock
keeprock / gulpfile.js
Created January 22, 2016 13:49
Latest working gulpfile config
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
sourcemaps = require('gulp-sourcemaps'),
prefix = require('gulp-autoprefixer'),
watch = require('gulp-watch'),
plumber = require('gulp-plumber'),
filter = require('gulp-filter'),
browserSync = require('browser-sync'),
reload = browserSync.reload;
@keeprock
keeprock / Better Emmet Media Queries
Last active June 26, 2017 16:53 — forked from jordanmoore/Better Emmet Media Queries
For Sublime 3 go to Preferences > Package Settings > Emmet > Setting - User and add this for writing better media queries quickly in Emmet. mqm => min-width media query mqx => max-width media query
{
"snippets": {
"css": {
"abbreviations": {
"mqm": "@media screen and (min-width:${1}) {\n\t|\n}",
"mqx": "@media screen and (max-width:${1}) {\n\t|\n}"
}
}
}
}
@keeprock
keeprock / app.js
Created October 19, 2015 13:51 — forked from kevinSuttle/app.js
Gulp, BrowserSync, Sass, Autoprefixer, Nodemon
var express = require('express');
var app = express();
var router = express.Router();
var hbs = require('hbs');
app.set('view engine', 'html');
app.engine('html', hbs.__express);
app.use(express.json());
app.use(express.urlencoded());
@keeprock
keeprock / request.js
Created October 10, 2015 22:03
Request Animation Frame
window.requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
function( callback ){
window.setTimeout(callback, 1000 / 60);
};
})();
@mixin fontFace($family,$src,$style: normal,$weight: normal) {
@font-face {
font-family: $family;
src: url('#{$src}.eot'); // IE9 compat
src: url('#{$src}.eot?#iefix') format('embedded-opentype'), // IE8 and below
url('#{$src}.woff') format('woff'), // standards
url('#{$src}.ttf') format('truetype'), // Safari, Android, iOS
url('#{$src}.svg##{$family}') format('svg'); // legacy iOS
font-style: $style;
@keeprock
keeprock / regex.php
Last active August 29, 2015 14:22
Use Regex to replace text between HTML tags
preg_match('/>([^<]*)/i', $bread_item, $text);
$bread_item_text = preg_replace("/&#?[a-z0-9]+;/i", "", $text[1]);
$bread_item_text = '>' . truncate_utf8($bread_item_text, 50, TRUE, TRUE, 1) . '<';
$bread_item_text = preg_replace('/>[^<]*</i', $bread_item_text, $bread_item);
$breadcrumb[$key] = $bread_item_text;
@keeprock
keeprock / script.js
Created April 9, 2015 07:39
Successful Ajax XHR
var success = Drupal.ajax.prototype.success;
Drupal.ajax.prototype.success = function (xmlhttprequest, options) {
success.apply(this, arguments);
// do stuff here
}
@keeprock
keeprock / style.js
Last active August 29, 2015 14:18
Create tooltip on click using marker
var point = new google.maps.LatLng(COORDS);
var data = "SOME_TEXT";
var infowindow = new google.maps.InfoWindow({
content: data
});
var marker = new google.maps.Marker({
position: point,
title:"SOME_TEXT"
});
google.maps.event.addListener(marker, 'click', function() {