Skip to content

Instantly share code, notes, and snippets.

@poeticninja
poeticninja / index.js
Created July 8, 2014 14:34
Fast Hapi Server, Hapi and Good
/**
* Dependencies.
*/
var hapi = require('hapi');
// Create a server with a host, port, and options
var server = hapi.createServer('0.0.0.0', parseInt(process.env.PORT, 10) || 3000);
server.pack.register([
{
@poeticninja
poeticninja / sublime-text-keyboard.json
Last active August 29, 2015 14:05
Custom keyboard shortcuts for Sublime Text
[
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" },
{
"keys": ["super+k", "super+1"],
"command": "set_layout",
"args": {
"cols": [0.0, 0.75, 1.0]
,"rows": [0.0, 1.0]
,"cells": [[0, 0, 1, 1], [1, 0, 2, 1]]
@poeticninja
poeticninja / server.js
Last active August 29, 2015 14:23
Base hapi server with logging.
/**
* Dependencies.
*/
var Hapi = require('hapi');
var Good = require('good');
var GoodConsole = require('good-console');
var Boom = require('boom');
var Joi = require('joi');
// Create a new server
import Ember from 'ember';
export default Ember.Component.extend({
willInsertElement: function(){
var scope = [].concat(this.get('scope'));
console.log(scope);
if(scope.indexOf('Testy') !== -1){
this.set('isVisible', false);
}
@poeticninja
poeticninja / gist:5985220
Created July 12, 2013 15:11
Here is how to add Medium to the Zurb Foundation 4 CSS framework. This makes the grid change on any html with the medium-$ class. Great for iPad and more custom sizing of website. Make sure you add this after the @import "foundation/components/global", "foundation/components/grid";.
@if $include-html-grid-classes != false {
/* Styles for screens that are atleast 768px and max width 1024px */
@media #{$small} and (max-width: 1024px) {
@for $i from 1 through $total-columns {
.medium#{-$i} { @include grid-column($columns:$i,$collapse:null,$float:false); }
}
@for $i from 0 through $total-columns - 1 {
@poeticninja
poeticninja / example-media-query-scss-1-mixins.scss
Last active December 19, 2015 20:09
The mixins below helps target small, medium, and large size screens for Zurb foundation 4. This also helps IE8 to be targeted. You can see IE8 being targeted in the large() mixin. It has .lt-ie9 being added on all specified large styling. This helped me a lot since IE 8 does not have media queries. Instead of targeting with a media query it targ…
@mixin small() {
@media only screen and (max-width: 767px) {
@content;
}
}
@mixin medium() {
@media only screen and (min-width: 768px) and (max-width: 1024px) {
@content;
}
@poeticninja
poeticninja / shuffle-array.js
Last active December 24, 2015 22:03
Shuffle Array
var list = [1,2,3,4,5,6,7,8,9];
list = list.sort(function() {
return Math.random() - 0.5;
});
console.log(list); // prints something like: 4,3,1,2,9,5,6,7,8
// For a raffle and 1 person to win.
@poeticninja
poeticninja / config.rb
Created November 5, 2013 21:51
Compass config for Ninja Stack. Run compass watch and all of your sass files in the sass folder will turn into css in the css folder. :D
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "public/css"
sass_dir = "public/sass"
images_dir = "public/images"
javascripts_dir = "public/javascripts"
# You can select your preferred output style here (can be overridden via the command line):
@poeticninja
poeticninja / index.html
Created January 20, 2014 18:44
Simple Angular example showing how to use $scope, ng-bind, ng-click, and ng-class,
<!doctype html>
<html ng-app>
<head>
<meta charset="UTF-8">
<title>Angular Bots</title>
<style>
.dead {
background-color: red;
border: black 1px solid;
}
@poeticninja
poeticninja / index.html
Created February 19, 2016 01:40
Footer stick to bottom of page.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<div class="wrapper">
<main>Main content here.</main>
</div>