This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
do ( d=document, w=window, $=jQuery ) -> | |
# ref http://qiita.com/Layzie/items/465e715dae14e2f601de | |
_is = (type, obj) -> | |
clas = Object.prototype.toString.call(obj).slice(8, -1) | |
return obj isnt undefined && obj isnt null && clas is type | |
# log output | |
log = -> | |
if (typeof console isnt 'undefined') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
do ( d = document, w = window, $ = jQuery ) -> | |
# Simple log function to keep the example simple | |
log = -> | |
console.log.apply console, arguments if typeof console isnt "undefined" | |
$ -> | |
viewArea = "#contents" | |
$.pjax | |
area: viewArea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
<!-- this block is main content area --> | |
</div> | |
<% | |
var fotter_script = (function () {/* | |
<script> | |
(function(d,w,$){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var path = require('path'); | |
var stylus = require("stylus"), nib = require("nib"); | |
var app = express(); | |
// app.use ... | |
app.use(stylus.middleware({ | |
src: path.join(__dirname, 'public'), | |
compile: function (str, path){ return stylus(str).set("filename", path).set("compress", true).use(nib()); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//for wordpress permalink import articles | |
function redirect301 ( req, res, next ){ | |
// console.log("access to: " + req.headers.host); | |
if ( req.query["p"] || req.query["page"] ){ | |
var redirect = "http://" + req.headers.host; | |
if ( req.query["p"] ){ | |
redirect += "/p" + req.query["p"] + ""; | |
} else if( req.query["page"] ){ | |
redirect += "/page" + req.query["page"] + ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
Gruntfile | |
If you created your Sails app with `sails new foo --linker`, | |
the following files will be automatically injected (in order) | |
into the EJS and HTML files in your `views` and `assets` folders. | |
At the top part of this file, you'll find a few of the most commonly | |
configured options, but Sails' integration with Grunt is also fully | |
customizable. If you'd like to work with your assets differently |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
# All Vagrant configuration is done here. The most common configuration | |
# options are documented and commented below. For a complete reference, | |
# please see the online documentation at vagrantup.com. | |
vagrant = JSON.parse(File.read("./vagrant.json")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function() { | |
var sails = global["sails"]; | |
if ( sails ){ | |
return sails.config; | |
} | |
else { | |
var app = require("../config/application"); | |
try { | |
var local = require("../config/local"); | |
var _ = require('underscore'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
npm i -g grunt-cli | |
npm i -g forever |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
do (d = document, w = window, $ = jQuery ) -> | |
window.alert "alert" | |
return |