Skip to content

Instantly share code, notes, and snippets.

@hamecoded
hamecoded / mongodb
Last active August 29, 2015 14:02
mongodb
## PART 1: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/
# install
brew install mongodb
#create path
mkdir -p /data/db
#launch mongodb
mongod
@hamecoded
hamecoded / grunt-contrib-watch
Last active August 29, 2015 14:02
The Secrets of the Full Stack Ninja Workshop - Part A - The Client Side
# how to kill a locked livereload port
➜ myBlog git:(master) ✗ grunt
Running "watch" task
Waiting...
Fatal error: Port 35729 is already in use by another process.
➜ myBlog git:(master) ✗ lsof -i tcp:35729
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
Google 308 odeds 209u IPv4 0xa02f8facf3fa33fd 0t0 TCP localhost:50291->localhost:35729 (ESTABLISHED)
node 27569 odeds 12u IPv4 0xa02f8facdaf1f3fd 0t0 TCP *:35729 (LISTEN)
node 27569 odeds 15u IPv4 0xa02f8facdaf24be5 0t0 TCP localhost:35729->localhost:50289 (CLOSE_WAIT)
@hamecoded
hamecoded / osx
Last active August 29, 2015 14:04
# dump file
sudo sysdiagnose -f ~/Desktop/
# file attributes
# http://mabouali.wordpress.com/2012/05/03/attribute-in-mac-osx-and-files-being-in-use-showing-in-gray/
xattr filename
xattr -d com.apple.FinderInfo filename
# mount ntfs drive as writable
# taken off a comment from post http://learnaholic.me/2013/11/11/enable-ntfs-write-on-mac-os-x-mavericks
window.lpTag=window.lpTag||{};if(typeof window.lpTag._tagCount==='undefined'){window.lpTag={site:'qa8237232'||'',section:lpTag.section||'',autoStart:lpTag.autoStart===false?false:true,ovr:lpTag.ovr||{domain : 'tlv_plankton3',tagjs : 'tlv_plankton4'},_v:'1.5.1',_tagCount:1,protocol:location.protocol,events:{bind:function(app,ev,fn){lpTag.defer(function(){lpTag.events.bind(app,ev,fn);},0);},trigger:function(app,ev,json){lpTag.defer(function(){lpTag.events.trigger(app,ev,json);},1);}},defer:function(fn,fnType){if(fnType==0){this._defB=this._defB||[];this._defB.push(fn);}else if(fnType==1){this._defT=this._defT||[];this._defT.push(fn);}else{this._defL=this._defL||[];this._defL.push(fn);}},load:function(src,chr,id){var t=this;setTimeout(function(){t._load(src,chr,id);},0);},_load:function(src,chr,id){var url=src;if(!src){url=this.protocol+'//'+((this.ovr&&this.ovr.domain)?this.ovr.domain:'lptag.liveperson.net')+'/tag/tag.js?site='+this.site;}var s=document.createElement('script');s.setAttribute('charset',chr?chr:
@hamecoded
hamecoded / npm-node
Created June 23, 2015 09:11
node and npm tips
# Node version management
https://github.com/tj/n
# Switch between different .npmrc files
https://github.com/deoxxa/npmrc
@hamecoded
hamecoded / slideshow.js
Created October 31, 2012 10:15
Image Slideshow
<div id="slider1" class="slider">
<img src="http://www.schrankmonster.de/content/binary/astronomy_day.jpg"></img>
<img src="http://imagenes.publico.es/resources/archivos/2011/12/5/1323109544448planetadn.jpg"></img>
<img src="http://img.ehowcdn.com/article-new/ehow/images/a04/t9/al/astronomy-science-fair-ideas-800x800.jpg"></img>
</div>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script src="slideshow.js"></script>
<script>
@hamecoded
hamecoded / logrotate.conf
Created November 20, 2012 10:47
configuring logrotate
# /etc/logrotate.conf
# this is the logrotate main file, see: include /etc/logrotate.d
# see "man logrotate" for details
# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 4
@hamecoded
hamecoded / app1.conf
Last active October 13, 2015 01:28
configuring nginx
#/etc/nginx/vhosts/app1.conf
upstream unicorn_app1 {
server unix:/home/user1/app1/shared/system/unicorn.sock;
}
server {
server_name domain.name.com, domain.name2.com;
# server_name _;
@hamecoded
hamecoded / log4j.properties
Created November 20, 2012 18:07
log4j properties
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.TTCCLayout
log4j.appender.stdout.layout.DateFormat=ISO8601
# File appender
log4j.appender.P=org.apache.log4j.DailyRollingFileAppender
log4j.appender.P.File=/var/log/app/app.log
#log4j.appender.P.MaxFileSize=10000KB
@hamecoded
hamecoded / HTML HAML BoilerPlate
Created December 13, 2012 16:38 — forked from am/index.haml
customized for mobile
# run ./buid_html from commandline
haml -f html5 index.haml > index.html