Skip to content

Instantly share code, notes, and snippets.

View stevehanson's full-sized avatar
🌞
Hello

Stephen Hanson stevehanson

🌞
Hello
View GitHub Profile
@stevehanson
stevehanson / Readme.md
Last active March 16, 2016 21:50
Gulp WP setup

Gulp WP setup

Includes a Gulp task that will watch the JavaScript and SCSS files and automatically build (compile, concat, minify, etc) them when they change. To set this up, perform the following steps:

  • Install Node.js and NPM
  • place package.json and gulpfile.js in your WP theme directory (eg. wp-content/themes/my-theme)
  • Navigate in your terminal to your theme directory
  • Install dependencies: npm install
  • Install the Gulp CLI: npm install -g gulp-cli
  • Run the Gulp watch task: gulp
@stevehanson
stevehanson / bug.rb
Last active March 28, 2017 17:30
Bug Tracking
class Bug
# log an error message to standard out
def self.log(message, data = {})
raise StandardError.new(message)
rescue => e
log_error(e, data)
end
# log an error/exception to standard out
def self.log_error(error, data = {})
import NavigationService from 'admin/services/navigation';
export default {
name: 'navigation',
initialize(container, app) {
var navigation = NavigationService.create({
links: [
{ name: 'Posts', link: 'posts'},
{ name: 'Settings', link: 'settings'},
],
import Ember from 'ember';
export default Ember.Component.extend({
listUpdated: 'listUpdated',
initSortable: function() {
var refreshed = false;
var _this = this;
this.$().sortable({
@stevehanson
stevehanson / promises.js
Created August 7, 2015 19:55
RSVP.all Promises Example
let promises = [];
comments.forEach((comment) => {
promises.push(comment.save());
});
Ember.RSVP.all(promises).then((comments) => {
post.get('comments').addObjects(comments);
post.save();
});
@stevehanson
stevehanson / emblem_to_hbs.rb
Last active February 22, 2019 21:54
Convert all project Emblem files to handlebars
class EmblemToHbs
def convert
Dir.glob("**/*.emblem").each do |file|
convert_file(file)
end
end
def convert_file(file)
`emblem2hbs #{file}`
File.delete(file)
@stevehanson
stevehanson / Gemfile
Last active February 4, 2021 23:06
Rails – Simple Google Login
gem "omniauth"
gem "omniauth-google-oauth2"
@stevehanson
stevehanson / transparent_bg.scss
Last active September 27, 2018 19:50
Mixin to achieve background-image with overlay
// see http://stackoverflow.com/questions/4183948/css-set-background-image-with-opacity
@mixin transparent_bg($bg_image, $overlay_opacity: "", $overlay_color: "") {
background: -webkit-linear-gradient(left, rgba($overlay_color, $overlay_opacity), rgba($overlay_color, $overlay_opacity)), url($bg_image) no-repeat;
background: -moz-linear-gradient(left, rgba($overlay_color, $overlay_opacity), rgba($overlay_color, $overlay_opacity)), url($bg_image) no-repeat;
background: -o-linear-gradient(left, rgba($overlay_color, $overlay_opacity), rgba($overlay_color, $overlay_opacity)), url($bg_image) no-repeat;
background: -ms-linear-gradient(left, rgba($overlay_color, $overlay_opacity), rgba($overlay_color, $overlay_opacity)), url($bg_image) no-repeat;
}
@stevehanson
stevehanson / Email.java
Created May 8, 2014 14:37
Mailgun Example - Java
package com.abc.model;
import java.util.List;
public class Email {
private String from;
private List<String> to;
private List<String> cc;
private List<String> bcc;
@stevehanson
stevehanson / MainController.java
Created January 10, 2014 15:16
Spring MVC Example
// com.tutorial.MainController.java
package com.tutorial;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;