Skip to content

Instantly share code, notes, and snippets.

@pat-eason
pat-eason / _sailsBlueprints.js
Created April 29, 2015 15:31
Sails Blueprint CRUD utility
/*
* Based off of Sails.js 0.11.1 Blueprints REST API generator
*/
Blueprints = {
serializeObject: function(){
//js function to create json object out of form data
$.fn.serializeObject = function(){
var o = {};
var a = this.serializeArray();
$.each(a, function() {
@ifnull
ifnull / README.md
Created July 8, 2014 19:16
Install xdebug and Webgrind for debugging Magento performance problems.

Install xdebug and Webgrind

sudo su -
pecl install xdebug
apt-get install unzip
curl -o /tmp/webgrind-release-1.0.zip https://webgrind.googlecode.com/files/webgrind-release-1.0.zip
unzip /tmp/webgrind-release-1.0.zip -d /srv/app/store/
chown -R vagrant:vagrant /srv/app/store/
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
@ttscoff
ttscoff / github_toc.rb
Last active January 24, 2023 23:08
A script to generate tables of contents for GitHub readme files
#!/usr/bin/env ruby
# encoding: utf-8
=begin
github_toc v0.2.0
Brett Terpstra 2014
<http://brettterpstra.com/2014/07/01/github-toc-service/>
Creates a linked table of contents from headers in a GitHub readme
Place a [toc] marker in the file to have it automatically replaced with the TOC
@coderofsalvation
coderofsalvation / is_file.bash
Created January 11, 2014 21:58
checks if given parameter is a file
# checks if given parameter is a file
# @param string filename
# usage: is_file my/path/foo.txt || echo "not a file"
is_file(){
[[ -f "$1" ]] && return 0 || return 1
}
@danielbwa
danielbwa / list_and_download_files_through_sftp_with_php.php
Last active November 16, 2022 09:38
List and download all files in a directory through sftp with php / ssh2. In my example i use scandir to list the files and ssh2_scp_recv to grab a file. I've found a lot of examples using fopen to grab the remote file, that didn't work for me and i found the code below cleaner than the fopen option. For an example on how to do the same as my exa…
<?php
$username = "your_username";
$password = "your_pass";
$url = 'your_stp_server_url';
// Make our connection
$connection = ssh2_connect($url);
// Authenticate
@ifnull
ifnull / gist:3961743
Created October 26, 2012 21:44
CURL IP w/ specific host
# Bypass HOSTS file and DNS and send request directly to IP with specified host name.
# Example below sends request to localhost with the host name www.foobar.com.
curl -sL -w "%{http_code}\\n" -o /dev/null --insecure --resolve 'www.foobar.com:127.0.0.1' https://www.foobar.com/