Skip to content

Instantly share code, notes, and snippets.

View philpalmieri's full-sized avatar
🏠
Working from home

Phil Palmieri philpalmieri

🏠
Working from home
View GitHub Profile
@philpalmieri
philpalmieri / new box
Created August 29, 2013 15:22
Notes for a new ubuntu box
//Install
apt-get install apache2
apt-get install php5 libapache2-mod-php5
apt-get install php5-imap
apt-get install libssh2-php
apt-get install mysql-server
@philpalmieri
philpalmieri / git
Created October 19, 2015 21:17
git tips
git diff : compare current with staged (or with last commit if no staged one)
git diff —staged : compare staged with last commit
git diff <master>…<topicbr> : show diff introduced by topicbr comparing to master (base commit in master)
git diff <sha-1> : show diff betwheen latest commit of current branch and other commit (sha-1)
git log -n : view last n commits
git log -n -p : last n commits with summary of changes (diff)
git log -n —graph : graphical view branch history
git log —pretty=oneline : each commit at one line
git log <br1> —not <br2> : list commits which are in br1 but not in br2
alias glog="git log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%ai) %C(bold blue)<%an>%Creset'"
@philpalmieri
philpalmieri / jquery
Last active January 25, 2018 13:42
jQuery Plugin Skeleton
// JQuery
(function(root, $) {
/**
* Doc Block
*/
function ClassName() {
// Methods and variables
}
// register namespace
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import 'rxjs/add/operator/map';
import {environment} from "../../environments/environment";
/** Encryption Stuff **/
var CryptoJS = require("crypto-js");
var hmacsha1 = require('hmacsha1');
@philpalmieri
philpalmieri / gform_s3_uploader.php
Created January 10, 2018 21:17 — forked from antonmaju/gform_s3_uploader.php
Gravity form filter to handle file upload integration with WP Offload S3 Lite plugin. Adapted from https://wordpress.org/support/topic/support-for-gravity-forms-uploads.
<?php
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
require_once WP_CONTENT_DIR.'/plugins/amazon-web-services/vendor/aws/aws-autoloader.php';
use \Aws\S3\S3Client;
add_filter('gform_upload_path', 'gform_change_upload_path', 10, 2);
add_action('gform_after_submission', 'gform_submit_to_s3', 10, 2);
//change gravity form upload path to point to S3
@philpalmieri
philpalmieri / gist:56a814510f4021f0b87e0faacddaf849
Created January 25, 2018 13:37
Node Fetch Test w/Chai and nock
import * as mocha from 'mocha';
import * as chai from 'chai';
import chaiHttp = require('chai-http');
import app from '../src/App';
let nock = require('nock');
chai.use(chaiHttp);
const expect = chai.expect;
@philpalmieri
philpalmieri / gist:e14c200a28189f4732afb6876016c369
Created January 25, 2018 13:40
Mocking custom analyitcs handler in Node with Sinon
import { Analytics } from './../src/Analytics';
import * as mocha from 'mocha';
import * as chai from 'chai';
const sinon = require('sinon');
const analytics = require('universal-ga');
const expect = chai.expect;
const fakeId = 'ABC-123-XYZ';
@philpalmieri
philpalmieri / testMocks.js
Created January 25, 2018 22:20 — forked from quitschibo/testMocks.js
How to mock jQuery calls with Jasmine. Just some examples ;)
describe('Mock jQuery calls with Jasmine', function() {
it('how to mock $("test").show()', function() {
// mock the call
spyOn($.fn, 'show').andCallFake(function() {
return true;
});
// now we can call the mock
result = $("test").show();
@philpalmieri
philpalmieri / currencies.json
Created February 1, 2018 21:49 — forked from mlvea/currencies.json
Common currencies as an array
[
{
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},