Skip to content

Instantly share code, notes, and snippets.

@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>
@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.
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 / 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
@poeticninja
poeticninja / index.html
Created October 28, 2014 14:32
base64 to file blob, very basic example.
<!doctype html>
<html>
<head>
<title>File Upload Page</title>
</head>
<body>
<h1 onClick="sendFormData()">Send it!</h1>
<script type="text/javascript">
@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 / 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 / test.js
Created May 20, 2014 14:59
Simple example of chai and selenium webdriver for node.js.
// Require chai.js expect module for assertions
var chai = require('chai');
var expect = require('chai').expect;
// Application Server
var serverUri = '0.0.0.0:3000';
// Official selenium webdriver testing setup
var webdriver = require('selenium-webdriver');
@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 / 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):