Skip to content

Instantly share code, notes, and snippets.

View raffpaquin's full-sized avatar

Raff Paquin raffpaquin

View GitHub Profile
@davidkelley
davidkelley / module.js
Last active January 12, 2021 16:33
AWS Request Signer V4 Javascript for jQuery AJAX
// Allows you to make signed requests by wrapping your original request object
// inside the Signer() function, then simply passing the return value to $.ajax.
//
// @note Depends on the CryptoJS library being present
//
// $.ajax(Signer(credentials, {
// url: 'https://xxxxxx.execute-api.us-east-1.amazonaws.com/v1/private',
// type: 'POST',
// context: this,
// dataType: 'json',
@jamtur01
jamtur01 / ladder.md
Last active April 28, 2024 20:07
Kickstarter Engineering Ladder
@bibstha
bibstha / gist:49540af53fa0ec5ab869
Last active February 5, 2021 07:47
Deploy to dokku from codeship.com

After migrating from heroku to dokku, we had to also chance codeship so we deploy to dokku. I followed the following steps to successfully deploy to dokku.

  1. Save the public key of the codeship project. It is found in Project Settings > General Settings.
  2. Copy the public key to a file /tmp/codeship_projectname.pub.
  3. Make sure when pasting, all the contents are in a single line and not multiple lines.
  4. Add the public key to dokku using the following command in console. Reference.
cat /tmp/codeship_projectname.pub | ssh root@yourdokkuinstance "sudo sshcommand acl-add dokku [description]"
@justmoon
justmoon / custom-error.js
Last active April 22, 2024 17:19 — forked from subfuzion/error.md
Creating custom Error classes in Node.js
'use strict';
module.exports = function CustomError(message, extra) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = message;
this.extra = extra;
};
require('util').inherits(module.exports, Error);
@mbajur
mbajur / index.html
Last active January 27, 2024 23:14
Working example of window.postMessage used for sending data from popup to parent page (works in IE)
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Index</title>
<script type="text/javascript">
window.open ("popup.html","mywindow", "width=350,height=250");
// Create IE + others compatible event handler
@bloodyowl
bloodyowl / gist:6543749
Created September 12, 2013 21:02
Jony Ive bullshit generator
;(function(){
var text = [
[
"Right from the beginning, it appeared to us that designing the new"
, "When we first thought about it, we understood that designing the new"
]
, [
" iPhone"
, " iMac"
@bradmontgomery
bradmontgomery / install-comodo-ssl-cert-for-nginx.rst
Last active April 1, 2024 11:21
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@rezwyi
rezwyi / google.analytics.js.coffee
Last active January 16, 2017 11:35
Google Analytics script in CoffeeScript
# See http://stackoverflow.com/questions/4214731/coffeescript-global-variables
root = exports ? this
root._gaq = [['_setAccount', 'UA-xxxxxxxx-y'], ['_trackPageview']]
insertGAScript = ->
ga = document.createElement 'script'
ga.type = 'text/javascript'
ga.async = true
proto = document.location.protocol
@umutakturk
umutakturk / php_mongodb_simple_pagination.php
Created September 29, 2012 19:01
PHP MongoDB Simple Pagination
<?php
$mongodb = new Mongo("mongodb://username:password@localhost/database_name");
$database = $mongodb->database_name;
$collection = $database->collection;
$page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
$limit = 12;
$skip = ($page - 1) * $limit;
$next = ($page + 1);
$prev = ($page - 1);
@drewjoh
drewjoh / custom.js
Created January 27, 2012 13:55
Dynamic (AJAX) loaded Bootstrap Modal (Bootstrap 2.1)
$(document).ready(function() {
// Support for AJAX loaded modal window.
// Focuses on first input textbox after it loads the window.
$('[data-toggle="modal"]').click(function(e) {
e.preventDefault();
var url = $(this).attr('href');
if (url.indexOf('#') == 0) {
$(url).modal('open');
} else {