Skip to content

Instantly share code, notes, and snippets.

@tonkapark
tonkapark / bigcartel_to_shopify_csv.rb
Created August 3, 2011 18:06
Generate a products csv file to make it easier to migrate from Big Cartel to Shopify
#script created by Matt Anderson, http://tonkapark.com
require 'rubygems'
require 'bigcartel'
require 'csv'
# SET YOUR BIGCARTEL ID HERE
STORE = 'ugmonk'
# SET THE BEST NAME FOR ANY DROP DOWN OPTIONS
@teradyne
teradyne / RazorEngine_Example_Template.cs
Created May 14, 2012 23:34
RazorEngine Example Template
//using the RazorEngine @http://razorengine.codeplex.com/
// I am using this with ASP.NET forms (.NET 4.0) for email templates
// 1. Email HTML Templates Location:
// ~/templates/email/MyEmailTemplate.cshtml (name something useful like Page, Master where email is being sent)
//Helper methods - put this shit in a common helper class like below:
using RazorEngine;
@chensoren
chensoren / gist:3081970
Created July 10, 2012 08:11
nodejs AES encrypt and decrypt
var crypto = require('crypto');
var AESCrypt = {};
AESCrypt.decrypt = function(cryptkey, iv, encryptdata) {
encryptdata = new Buffer(encryptdata, 'base64').toString('binary');
var decipher = crypto.createDecipheriv('aes-256-cbc', cryptkey, iv),
decoded = decipher.update(encryptdata);
@redoPop
redoPop / tzAbbr.js
Last active May 17, 2024 04:05
JavaScript: friendly timezone abbreviations in the client ("EDT", "CST", "GMT", etc.)
/*
Given a date, tzAbbr returns a short, friendly name for the
user's time zone on that date, or an empty string if their
client's Intl support is missing or incomplete.
For example, a user in New York might see:
tzAbbr(new Date()) // => "EST"
Time zones are locale-dependent. Users traveling outside of
@jamesmosier
jamesmosier / index.html
Created November 21, 2012 15:40
A CodePen by Erick Arbe. The Backside Menu Flip - A responsive navigation pattern whereas the nav (under 768px) is located on the "backside" of the page content.
<div id="page_container">
<div id="main_content">
<div class="front face">
<!-- ALL THE SITE CONTENT GOES HERE -->
<header class="clearfix">
@erwaller
erwaller / README.md
Last active December 20, 2015 11:29
3D Seating Charts
@tbranyen
tbranyen / _usage.md
Last active August 15, 2024 21:13
OpenWeatherMap / Weather Icons integration
  1. Include Weather Icons in your app: https://github.com/erikflowers/weather-icons

  2. Include the below JSON in your application, for example purposes, lets assume it's a global named weatherIcons.

  3. Make a request to OpenWeatherMap:

req = $.getJSON('http://api.openweathermap.org/data/2.5/weather?q=London,uk&callback=?');

@kangax's ES6 quiz, explained

@kangax created a new interesting quiz, this time devoted to ES6 (aka ES2015). I found this quiz very interesting and quite hard (made myself 3 mistakes on first pass).

Here we go with the explanations:

Question 1:
(function(x, f = () =&gt; x) {
var dispatchErrorEvent = (function IIFE(){
var createErrorEvent;
try {
try {
new ErrorEvent("error",{});
createErrorEvent = function createErrorEvent(err) {
return new ErrorEvent("error",{
error: err,
@Rich-Harris
Rich-Harris / service-workers.md
Last active June 23, 2025 19:36
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.