Skip to content

Instantly share code, notes, and snippets.

View ajmalafif's full-sized avatar
💻

Ajmal Afif ajmalafif

💻
View GitHub Profile
@johanhalse
johanhalse / gist:9049840
Created February 17, 2014 12:39
JavaScript concatenation and uglification with Harp server
// Wrapper for Harp web server, to include JS concat/compile step. Put your stuff
// in /harp subdirectory, npm install your dependencies, run, enjoy.
// Live updating of the concatenated JS file left as an exercise for the reader :)
var fs = require('fs');
var path = require('path');
var harp = require('harp');
var UglifyJS = require('uglify-js');
var files = [];
files.push(__dirname + '/harp/js/file0.js');
// Wrapper for Harp web server, to include JS concat/compile step. Put your stuff
// in /harp subdirectory, npm install your dependencies, run, enjoy.
// Live updating of the concatenated JS file left as an exercise for the reader :)
var fs = require('fs');
var path = require('path');
var harp = require('harp');
var UglifyJS = require('uglify-js');
var files = [];
files.push(__dirname + '/harp/js/file0.js');
@zakhardage
zakhardage / Shopify Cart Permalink
Created March 7, 2014 07:00
How to construct the permalink by looping through cart.items
@weotch
weotch / commands.md
Last active August 29, 2015 14:02
Moving files between PagodaBox instances

Since you can't ssh from PagodaBox (the binary isn't installed), you can't rsync or scp between servers. Thus you need to copy them locally and then upload back up

  1. Enable ssh in PB for both servers.
  2. SSH to the first server and tar the uploads dir: tar -cvf uploads.tar shared/public/uploads. Not bothering with zipping causing it would take along time and it's all binary so I don't expect much compression help.
  3. Download the uploads.tar file to your comp.
  4. Delete uploads.tar file from server.
  5. Upload uploads.tar file to the root of second server.
  6. Connect to second server via SSH
  7. Uncompress it: tar -xvf uploads.tar
  8. Delete uploads.tar file from the second server
@gavinballard
gavinballard / post-checkout.rb
Last active August 29, 2015 14:07
A Git hook to automatically update the Shopify Theme Gem's config.yml on a branch switch.
#!/usr/bin/env/ruby
require 'yaml'
# Get the "type" of checkout from the arguments Git passes to us.
# Possible values for this are "0" for a file-only checkout (which we dont' care about)
# or "1" for a full branch checkout (which we do).
checkout_type = ARGV[2]
if checkout_type == "1"
@taesup
taesup / perfschool-pagespeed
Created July 29, 2015 06:12
answer to perfschool problem 1
'use strict';
var fs = require('fs');
var path = require('path');
var express = require('express');
var psi = require('psi');
var app = express();
var port = process.env.PORT || 7777;
app.get('/', home);
@ma11hew28
ma11hew28 / .bash_profile
Last active September 4, 2015 20:34
.bash_profile file
# Homebrew, Ruby, Bash Completion
# After upgrading Ruby, run: gem pristine --all --only-executables
export PATH="/usr/local/bin:/usr/local/opt/ruby/bin:$PATH"
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
# Directory Shortcuts
alias prj='cd "$HOME/Projects/"'
@maxfell
maxfell / body.html
Created January 5, 2012 20:59
Art Directed posts in tumblr
<!-- Make sure to load the injectCSS() function when the body is loading -->
<body onload="injectCSS();">
FUN
</body>
@nanobox-io
nanobox-io / gist:1756086
Last active September 30, 2015 08:58
Deploy Hook Available Executables
awk
bunzip2
bzcat
bzip2
cat
chown
cp
curl
cut
date
@ajmalafif
ajmalafif / posterous-octopress.rb
Created March 5, 2012 09:05 — forked from rmurphey/posterous-octopress.rb
[ruby] - Generate Octopress posts from Posterous XML
#!/usr/bin/env ruby
require 'xmlsimple'
require 'active_support/inflector'
require 'yaml'
require 'json'
require 'fileutils'
require 'date'
class Post