Skip to content

Instantly share code, notes, and snippets.

@imryanjay
imryanjay / getHBValues.js
Last active May 16, 2022 00:19
Function to get handlebar values from a template
import _ from 'lodash';
export const getHBValues = (text) => {
const re = /{{[{]?(.*?)[}]?}}/g;
const tags = [];
let matches;
while (Boolean((matches = re.exec(text)))) {
if (matches) {
tags.push(matches[1]);
}
@imryanjay
imryanjay / AJAX
Created April 27, 2013 18:08
Trying to figure out what posting comments through Facebook's graph API only sometimes works
$(document).on('click', '.comment_submit', function(e) {
var $this = $(this);
var post_id = $this.closest('.box').attr('data-post_id');
var comment = $this.siblings('.comment_form').val();
$.ajax({
type: 'GET',
url: 'interactions/facebook.interaction.php',
data: {
post_id: post_id,