Skip to content

Instantly share code, notes, and snippets.

View freidamachoi's full-sized avatar

Bo freidamachoi

View GitHub Profile
@jonathantneal
jonathantneal / README.md
Last active July 24, 2023 08:35
Fluid Aspect: A Sass mixin for creating intrinsic ratios

Fluid Aspect

fluid-aspect is a Sass mixin for creating intrinsic ratios in CSS. Intrinsic ratios allow elements to fill the width of their containing block and resize on the fly while maintaining their aspect ratio.

@include fluid-aspect($ratio, [$target]);
  • $ratio: An aspect ratio represented as two numbers separated by a space. Defaults to 1:1
  • $target: A selector targeting the element to be made fluid. Defaults to "> :first-child"
@ericelliott
ericelliott / essential-javascript-links.md
Last active May 17, 2024 03:38
Essential JavaScript Links
@ThomasBurleson
ThomasBurleson / docSearcher.js
Last active August 29, 2015 14:10
Enhanced version of `docSearcher` webWorker discussed in Pete Darwin's blog [AngularJS Docs Performance](http://www.bacondarwin.co.uk/angularjs-docs-performance/)
angular.module('search', [])
.service('docsSearch', ['$q','$rootScope','$timeout','NG_PAGES',BackgroundSearchService]);
/**
* Document search service that uses Web Workers to index
* and search in the background.
*/
function BackgroundSearchService($q, $rootScope, $timeout, NG_PAGES) {
console.log('Using WebWorker Search Index');
@freidamachoi
freidamachoi / app.js
Created June 3, 2014 19:45 — forked from katowulf/app.js
Kato's queue service --- we use this.
var Firebase = require('firebase');
var Request = require('./request.js');
var Reply = require('./reply.js');
var Tasks = require('./tasks');
var Queue = require('./queue.js');
var fb = new Firebase(process.env.FIREBASE_URL).child('queue');
fb.auth(process.env.FIREBASE_TOKEN, function(err) {
if(err) { throw err; }
else {
@Integralist
Integralist / 0. JavaScript Function Programming TOC.md
Last active July 3, 2018 04:57
JavaScript Function Programming (scratch pad) -> Most of the code here is modified from the excellent O'Reilly book "Functional JavaScript".

This code is modified from the excellent O'Reilly book "Functional JavaScript". You should buy it, I highly recommend it! Don't kid yourself into thinking this gist even remotely covers the great content from a 200+ page technical book on the subject; it doesn't. Buy the book and get the in-depth knowledge for yourself. It's worth it.

@freidamachoi
freidamachoi / multi-collections.js
Created February 25, 2014 17:33 — forked from aheckmann/multi-collections.js
MongooseJs/Mongo Multitenant
var mongoose = require('mongoose');
mongoose.connect('localhost', 'testing_multiTenant');
/**
* User schema.
*/
var UserSchema = new mongoose.Schema({
name: String
, prefix: { type: String, required: true }
@idosela
idosela / http-response-interceptor.js
Last active February 25, 2024 12:51
Sample code for ng-conf 2014
angular.module('myMdl', []).config(['$httpProvider', function($httpProvider) {
$httpProvider.responseInterceptors.push([
'$q', '$templateCache', 'activeProfile',
function($q, $templateCache, activeProfile) {
// Keep track which HTML templates have already been modified.
var modifiedTemplates = {};
// Tests if there are any keep/omit attributes.
var HAS_FLAGS_EXP = /data-(keep|omit)/;
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active May 30, 2024 08:12
A badass list of frontend development resources I collected over time.
@jaredhirsch
jaredhirsch / gist:4971859
Created February 17, 2013 15:19
all about ETags

ETags: a pretty sweet feature of HTTP 1.1

HTTP caching review

HTTP provides two ways for servers to control client-side caching of page components:

  • freshness may be based on a date or a token whose meaning is app-specific
  • whether or not the client needs to confirm the cached version is up-to-date with the server

This breaks down as follows:

  • Cache locally and don't check before using.
@anantn
anantn / firebase_queue_pop.js
Last active December 10, 2015 01:19
Firebase: Using .push() to maintain a queue and ensuring only one client is able to obtain the head of the queue at a time.
var Firebase = require("./firebase-node.js");
function Queue(ref) {
this._ref = ref;
}
Queue.prototype.pop = function(cb) {
this._ref.startAt().limit(1).once("child_added", this._pop.bind(this, cb));
}