Skip to content

Instantly share code, notes, and snippets.

captDaylight

Block or report user

Report or block captDaylight

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View rhino_test.py
import random
import rhinoscriptsyntax as rs
def draw_box(x, y, z, box_size):
surface_points = [
[x, y, z],
[x + box_size, y, z],
[x + box_size, y + box_size, z],
[x, y + box_size, z]
]
View lorem.js
router.put('/user/:refCode', function(req, res, next) {
if (!req.params.refCode) res.json({ result: 'error', msg: 'must send an referral code'});
var newEmail = req.body.email ? req.body.email : '';
mailchimp.get({
path: 'lists/' + listID + '/members?unique_email_id=' + req.params.refCode,
})
.then(function(search) {
const user = search.members[0];
View lorem.js
(function() {
var searchQuery = window.location.search;
var ref;
var $form;
var userEmail;
if (searchQuery !== '' && searchQuery.indexOf('ref=') > -1) {
ref = searchQuery.split('=')[1];
console.log('ref',ref);
$form = $('form.newsletter-form');
@captDaylight
captDaylight / markdownHeaderParse.js
Created Feb 21, 2018
Get the headers from markdown along with the header type
View markdownHeaderParse.js
var re = /(#+)(.*)/;
var str = '## About Bottler\n\nThis is something about the project\n\n# something else\n';
function findAll(regex, sourceString, aggregator = []) {
const arr = re.exec(sourceString);
if (arr === null) return aggregator;
const newString = sourceString.slice(arr.index + arr[0].length);
return findAll(regex, newString, aggregator.concat([arr]));
View gist:7e387fce153de204ffd8569c30c27506
{
0: {
"Introduction": "# intro/n/n ## hello there...."
},
1: {
"Getting Started":
{
0: {
"Step One": "# stepone/n/n ## hello there..."
},
View sample_docs_array.json
[
{
"Introduction": "# intro/n/n ## hello there...."
},
{
"Getting Started":
[
{
"Step One": "# stepone/n/n ## hello there..."
},
View auth.js
const jwt = require('jsonwebtoken');
const models = require('../models');
const Strategy = require('passport-local');
function generateToken(req, res, next) {
res.cookie('token',
jwt.sign({ id: req.user.id }, process.env.SECRET),
{
maxAge: 86400000,
httpOnly: true,
@captDaylight
captDaylight / auth.js
Last active Nov 22, 2016
Generating JWT for my current project
View auth.js
const jwt = require('jsonwebtoken');
const models = require('../models');
const Strategy = require('passport-local');
function generateToken(req, res, next) {
res.cookie('token',
jwt.sign({ id: req.user.id }, process.env.SECRET),
{
maxAge: 86400000,
httpOnly: true,
View paperRockScissorsBot.js
if (!process.env.token) {
process.exit(1);
}
const Botkit = require('botkit');
const controller = Botkit.slackbot({
debug: true,
});
View botSnippet14.js
} else {
const gameResults = playerIDs.map((id) => `<@${id}> played ${players[id].played}`);
bot.reply(message, gameResults.join(' & '));
// reset the game data
channels.save({ id: updateData.id }, (err) => {
if (err) throw err;
});
}
You can’t perform that action at this time.