Skip to content

Instantly share code, notes, and snippets.

View geddski's full-sized avatar

Dave Geddes geddski

View GitHub Profile
View gist:e70685ec9560c7d1c4d1

Here's the project structure:

project
  |--main/
      config.js
      app.js
  |--subproject/
      app.js
@geddski
geddski / template.js
Created October 28, 2014 19:32
simple Angular template loader for webpack
View template.js
/**
* Import an Angular template.
* Returns the HTML as a string
* Could be chained with a separate loader if you want to populate Angular's template cache
*/
module.exports = function(source) {
var html = "'" + source.replace(/"/g, '\\\"').replace(/\n/g, '\\') + "'";
return "module.exports = \"" + html + "\"";
};
@geddski
geddski / model.js
Created January 7, 2015 23:54
model.js
View model.js
/**
* Feedback from real use:
* 1. Need to be able to transform the entire request before it even arrives to the model,
* not just transform each item (but want that too)
* 2. Declaring which fields you want is kinda lame, I wasted time trying to track down
* why the "children" field wasn't showing up.
* 3. Caching most definitely needs to be optional
* 4. transformOut CAN'T modify the original object right? Or the UI will hork? It's safe when using toJSON and fromJSON since those make new objects I think. Will need to add a test for this.
* 5. model.json() and model.rest() APIs seem wonky, should just be combined. Can still make cache separete or make it an option.
*/
View postcss-syntax
component(nav){
part (item){
option(selected){
background: blue;
}
}
}
@geddski
geddski / joyentdocker
Created April 3, 2015 04:22
fishshell function for using joyent's docker
View joyentdocker
# Use joyent's configuration for docker in the cloud.
# This makes it easy to toggle between using joyent and using local docker.
# Use your joyent username on line 8
# Use your joyent host if different
function jdocker
set -e DOCKER_TLS_VERIFY
set -gx DOCKER_CERT_PATH ~/.sdc/docker/<YOUR JOYENT USERNAME>
set -gx DOCKER_HOST "tcp://us-east-3b.docker.joyent.com:2376"
docker --tls $argv
View 20CSSRulesForRyan.css
@-webkit-keyframes rotate { from { -webkit-transform: rotate(0deg); -moz-transform: rotate(0deg); -ms-transform: rotate(0deg); transform: rotate(0deg); }
to { -webkit-transform: rotate(360deg); -moz-transform: rotate(360deg); -ms-transform: rotate(360deg); transform: rotate(360deg); } }
*, html, body { -webkit-font-smoothing: antialiased; }
a { color: #39464e; text-decoration: none; }
a:hover { text-decoration: underline; }
input, textarea, select { font-family: "Open Sans", "Helvetica", "Arial", "FreeSans", "Verdana", "Tahoma", "Lucida Sans", "Lucida Sans Unicode", "Luxi Sans", sans-serif; }
@geddski
geddski / test
Created July 7, 2011 20:39
Test
View test
alert("test");
@geddski
geddski / splice-demo.js
Created August 6, 2011 05:31
Removing elements from an array
View splice-demo.js
var books = ["Ender's Game", "The Hobbit", "The Alliance"];
books.splice(1,1);
console.log(books);
//["Ender's Game", "The Alliance"]
@geddski
geddski / npminstall.js
Created March 16, 2012 19:35
test programmatic npm install
View npminstall.js
var npm = require('npm');
npmInstall(['http://dl.dropbox.com/u/3098507/sample.tar.gz'], function () {
console.log('yay');
});
/*
programmatically install some libs with npm
working in OSX but not windows
*/
function npmInstall(libs, callback){
@geddski
geddski / base.css
Created August 2, 2012 19:11
mobile (base) stylesheet example
View base.css
body{
background: orange;
}