Skip to content

Instantly share code, notes, and snippets.

View ajmalafif's full-sized avatar
💻

Ajmal Afif ajmalafif

💻
View GitHub Profile
@ajmalafif
ajmalafif / publish.sh
Created February 9, 2014 16:47 — forked from edrex/publish.sh
#!/bin/sh
# Be sure to set the index and 404 docs to "index" and "404" respectively in your bucket settings
# replace with your compile command
harp compile ./ ./out
# removes the html extension
for f in `ls out/*.html out/**/*.html`; do mv $f "${f%%.*}"; done
// 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');
function archiveOld() {
var threads = GmailApp.search('in:inbox -is:starred older_than:7d');
for (var thread in threads) {
GmailApp.moveThreadToArchive(threads[thread]);
}
}
archiveOld();
<div>
<label for="sort-by">Sort by</label>
<select id="sort-by">
<option value="manual">Featured</option>
<option value="price-ascending">Price: Low to High</option>
<option value="price-descending">Price: High to Low</option>
<option value="title-ascending">A-Z</option>
<option value="title-descending">Z-A</option>
<option value="created-ascending">Oldest to Newest</option>
<option value="created-descending">Newest to Oldest</option>
<div>
<label for="sort-by">Sort by</label>
<select id="sort-by">
<option value="manual">Featured</option>
<option value="price-ascending">Price: Low to High</option>
<option value="price-descending">Price: High to Low</option>
<option value="title-ascending">A-Z</option>
<option value="title-descending">Z-A</option>
<option value="created-ascending">Oldest to Newest</option>
<option value="created-descending">Newest to Oldest</option>
// 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');
<script>
// (c) Copyright 2014 Caroline Schnapp. All Rights Reserved. Contact: mllegeorgesand@gmail.com
// See http://docs.shopify.com/manual/configuration/store-customization/advanced-navigation/linked-product-options
var Shopify = Shopify || {};
Shopify.optionsMap = {};
Shopify.updateOptionsInSelector = function(selectorIndex) {
require('harp').server(__dirname + '/public', { port: process.env.PORT || 5000 });
var marked = require('./node_modules/harp/node_modules/terraform/node_modules/marked');
var highlight = require('highlight.js');
marked.setOptions({
langPrefix: '',
highlight: function (code, language) {
if (language) {
return highlight.highlight(language, code).value;
/* Sample JavaScript file added with ScriptTag resource.
This sample file is meant to teach best practices.
Your app will load jQuery if it's not defined.
Your app will load jQuery if jQuery is defined but is too old, e.g. < 1.7.
Your app does not change the definition of $ or jQuery outside the app.
Example: if a Shopify theme uses jQuery 1.4.2, both of these statements run in the console will still return '1.4.2'
once the app is installed, even if the app uses jQuery 1.9.1:
jQuery.fn.jquery => "1.4.2"
$.fn.jquery -> "1.4.2"
*/
def pbcopy(str)
IO.popen('pbcopy', 'r+') {|io| io.puts str }
output.puts "-- Copy to clipboard --\n#{str}"
end
Pry.config.commands.command "hiscopy", "History copy to clipboard" do |n|
pbcopy _pry_.input_array[n ? n.to_i : -1]
end
Pry.config.commands.command "copy", "Copy to clipboard" do |str|