Skip to content

Instantly share code, notes, and snippets.

View x5engine's full-sized avatar
🎉
Winning

X5 Engine x5engine

🎉
Winning
View GitHub Profile
@x5engine
x5engine / slugify.js
Last active December 23, 2019 08:14 — forked from codeguy/slugify.js
Create slug from string in Javascript ES7
export default (str) => {
str = String(str).toString();
str = str.replace(/^\s+|\s+$/g, ""); // trim
str = str.toLowerCase();
// remove accents, swap ñ for n, etc
const swaps = {
'0': ['°', '₀', '۰', '0'],
'1': ['¹', '₁', '۱', '1'],
'2': ['²', '₂', '۲', '2'],
var Col = require('react-bootstrap/lib/Col')
var PageHeader = require('react-bootstrap/lib/PageHeader')
var React = require('react')
var Row = require('react-bootstrap/lib/Row')
var {connect} = require('react-redux')
var {reduxForm} = require('redux-form')
var DateInput = require('./DateInput')
var FormField = require('./FormField')
var LoadingButton = require('./LoadingButton')
@x5engine
x5engine / mail-sendgrid.js
Created January 23, 2016 02:45 — forked from aaronthorp/mail-sendgrid.js
SMTP via SendGrid using Email package with Meteor
if (Meteor.isServer) {
Meteor.startup(function () {
process.env.MAIL_URL = 'smtp://username:password@smtp.sendgrid.net';
Accounts.emailTemplates.siteName = "My Website Name";
Accounts.emailTemplates.from = "My Website Name <noreply@mywebsite.com>";
Accounts.emailTemplates.resetPassword.subject = function(user) {
return "How to reset your password for My Website Name";
@x5engine
x5engine / url_slug.js
Last active August 29, 2015 14:21 — forked from sgmurphy/url_slug.js
/**
* Create a web friendly URL slug from a string.
*
* Requires XRegExp (http://xregexp.com) with unicode add-ons for UTF-8 support.
*
* Although supported, transliteration is discouraged because
* 1) most web browsers support UTF-8 characters in URLs
* 2) transliteration causes a loss of information
*
* @author Sean Murphy <sean@iamseanmurphy.com>
import os, os.path, time, urllib, urllib2, json, datetime
base = os.getcwd() + '/packages/'
apiUrl = 'https://atmospherejs.com/a/packages/findByNames'
for dirname in os.listdir(base):
max_mtime = 0
if os.path.isdir(base + dirname):
packageName = dirname.replace('-', ':', 1)
for fname in os.listdir(base + dirname):
full_path = base + dirname + '/' + fname