Skip to content

Instantly share code, notes, and snippets.

@SachaG
SachaG / feed
Last active August 29, 2015 14:25
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Screenings]]></title><description><![CDATA[The best design videos]]></description><link>http://apple.com/p</link><image><url>http://apple.com/pimg/favicon.png</url><title>Screenings</title><link>http://apple.com/p</link></image><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Jul 2015 01:55:41 GMT</lastBuildDate><atom:link href="http://apple.com/pfeed.xml" rel="self" type="application/rss+xml"/><imageUrl>http://www.bar.com/</imageUrl><item><title><![CDATA[How Designers Destroyed the World]]></title><description><![CDATA[You are directly responsible for what you put into the world. Yet every day designers all over the world work on projects without giving any thought or consideration to the impact that work has on the world around them. This needs to change.</br></br><a href="http
Users.getDisplayName = function (user) {
console.log(user)
console.log(this)
return (user.telescope && user.telescope.displayName) ? user.telescope.displayName : Users.getUserName(user);
};
Users.helpers({
getDisplayName: function () {
return Users.getDisplayName(this);
}
@SachaG
SachaG / posts_list_controller.html
Last active March 2, 2016 23:26
Template Controller
<template name="postsListController">
{{> posts_list context}}
</template>
@SachaG
SachaG / gist:f22e04bf91751435806d
Created April 22, 2015 08:00
Telescope Package Hierarchy

Telescope has three tiers of packages.

Lib Packages

These are third-party packages such as Iron Router, SimpleSchema, AutoForm, etc. that are used throughout the app. Inside telescope:lib, they are used (api.use()) and then implied (api.imply()), which makes them available to any package that then uses telescope:lib.

Here's the full list:

  api.use([
var capitaliseFirstLetter = function (string){
return string.charAt(0).toUpperCase() + string.slice(1);
}
var buildTwitterLink = function (text, url) {
var encodedUrl = encodeURIComponent(url);
var referrer = encodeURIComponent("http://communitybuildingguide.com");
// var url = "http%3A%2F%2Fbook.discovermeteor.com%2Fstarter%3Futm_source%3Dstarter%26utm_medium%3Dtwitter%26utm_campaign%3Dstarter_tweet";
return "https://twitter.com/intent/tweet?original_referer="+referrer+"&url="+encodedUrl+"&text="+encodeURIComponent(text)+"&hashtags=combuild&via=telescopeapp";
}
@SachaG
SachaG / gist:a04d3263cd00e2f0318b
Created March 12, 2015 07:51
Template Highlighting for Meteor
Template.onRendered(function () {
var node = this.firstNode;
if (node && node.nodeType !== 3) { // get rid of text nodes
$node = $(node);
var template = this.view.name;
$node.addClass('is-template').attr('data-template', template);
// avoid giving position:relative to absolute elements
if ($node.css('position') == 'static') {
$node.css('position', 'relative');

Hello,

Many times, we see smaller sized droplets run out of memory due to the number of processes that are running. This can cause slow connections, services to crash and overall unpredictable behavior.

Potential solutions are:

  1. Upsize to a larger server. We recommend at least a 1GB droplet for any server utilizing a MySQL database.

  2. Enable swap (search for 'swap' in our articles https://digitalocean.com/community)

@SachaG
SachaG / README.md
Last active June 8, 2017 15:15
Meteor Pagination Package

Idea 1: Client Only

The user sets up the subscription and publication to take a postsLimit Session variable as parameter.

The pagination helper takes care of changing the Session variable on click.

Idea 2: Client/Server (see below)

Template

@SachaG
SachaG / gist:279e6452d45128b08b06
Created August 25, 2014 02:14
template highlighting
var oldCreate = Template.__create__;
Template.__create__ = function(viewName) {
var tmpl = oldCreate.apply(this, arguments);
var oldRender = tmpl.__render;
tmpl.__render = function() {
var className = viewName.replace('Template.', 'template-highlight ');
return HTML.SPAN({class: className}, oldRender.apply(this, arguments));
}
return tmpl;
@SachaG
SachaG / gist:d57fccc728dd2959f8d0
Last active August 29, 2015 14:03
Iron Router subscription loading pattern
// Global data controller
DataController = RouteController.extend({
onBeforeAction: function(pause) {
var loading = false, notFound = false;
_.each(this.routeData(), function (dataItem) {
var handle = dataItem.subscription;