Skip to content

Instantly share code, notes, and snippets.

@joepie91
joepie91 / some-module.js
Last active Aug 29, 2015
Configurable exports in Node.js
View some-module.js
module.exports = function(configuration) {
var configuredInstance = createInstance(configuration);
return function(argOne, argTwo) {
configuredInstance.doThing(argOne)
return configuredInstance.doAnotherThing(argTwo);
}
}
@nzakas
nzakas / job.md
Last active Aug 29, 2015
Staff Software Engineer, Front-end Frameworks, Box
View job.md

Staff Software Engineer, Front-end Frameworks (Los Altos, CA)

Box's Front-end Frameworks team is looking for an experienced engineer to join us at our Los Altos, CA headquarters on our mission to make building web applications on top of the Box infrastructure easy, fast, and fun.

About the Team

Front-end Frameworks ensures that Box web applications are built on top of the best tools and frameworks available. We actively evaluate third-party libraries and frameworks, as well as building our own, to make sure our feature teams can be as effective and iterative as possible. In the past two years, we've led the establishment of front-end best practices, created a lightweight client-side framework that has improved developer experience by enforcing conventions and loose coupling, and started putting together a Node.js framework to power the next generation of Box web applications.

About the Job

@jmcph4
jmcph4 / gridster.html
Created Oct 22, 2012
A very quick and very messy example of the jQuery plugin gridster.js.
View gridster.html
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript" src="https://raw.github.com/ducksboard/gridster.js/master/dist/jquery.gridster.min.js"></script>
<script type="text/javascript">
$(function(){ //DOM Ready
$(".gridster ul").gridster({
widget_margins: [10, 10],
widget_base_dimensions: [140, 140]
@qawemlilo
qawemlilo / paginate.js
Last active Dec 7, 2015
HBS helper for pagination
View paginate.js
hbs.registerHelper('paginate', function(pagination, context) {
var lists = '';
if (pagination.isFirstPage) {
lists += '<li class="disabled"><a href="#">&laquo; Prev</a></li>';
}
else {
lists += '<li><a href="' + pagination.base + '?';
lists += 'p=' + pagination.prev + '">' + '&laquo; Prev</a></li>';
View gist:6085968
[httplog] Connecting: sandbox.usaepay.com:443
[httplog] Sending: POST http://sandbox.usaepay.com:443/soap/gate/spree123
[httplog] Data: <?xml version="1.0" encoding="utf-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:usaepay" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:runAuthOnly><Token xsi:type="ns1:ueSecurityToken"><PinHash xsi:type="ns1:ueHash"><HashValue xsi:type="xsd:string">7bad37464279bd9016392f12ed2cf8befa8bc232</HashValue><Seed xsi:type="xsd:string">FMTGVOkHvfkugXNC7rZwkLS1PJyOjvBolQiFBs+Evzg=</Seed><Type xsi:type="xsd:string">sha1</Type></PinHash><SourceKey xsi:type="xsd:string">0r19zQBdp5nS8i3t4hFxz0di13yf56q1</SourceKey></Token><Params xsi:type="ns1:TransactionRequestObject"><CreditCardData xsi:type="ns1:CreditCardData"><CardNumber xsi:type="xsd:stri
@eshacker
eshacker / wrong_vs_right_oo_in_js.js
Last active Mar 2, 2016
Wrong versus right way to do OO in JS
View wrong_vs_right_oo_in_js.js
/* Reading https://drboolean.gitbooks.io/mostly-adequate-guide/content/ch1.html
* I have a differing opinion. Please help in sorting it out.
*/
// Original code : or I think wrong way to to Object Oriented code.
var Flock = function(n) {
this.seagulls = n;
};
View hexes.pde
import gifAnimation.*;
GifMaker gifExport;
int loopFrames = 60;
PVector maskOrigin;
Float maskWidth = 250.0;
float orbitWidth = 100.0;
void setup() {
gifExport = new GifMaker(this, "export.gif", 30);
@rahuljiresal
rahuljiresal / openshift-node-force-domain.js
Last active Jul 22, 2016
This is a middleware for Connect and Express that redirects any requests to a default domain. Based on https://github.com/goloroden/node-force-domain, modified to work on Openshift platform.
View openshift-node-force-domain.js
/*
Openshift uses haproxy (haproxy.org) as a front proxy to route request to instances of the app.
This proxy does the job of unwrapping https and sets the 'x-forwarded-proto' header.
Because of this, the Node.JS app never sees the actual protocol of the request, unless it checks the presence of this header.
I modified the code written by goloroden (https://github.com/goloroden/node-force-domain) to check this header instead of ports.
This gist does exactly what his code does, except checks for actual protocol instead of relying on the port for the protocol.
*/
var rewrite = function (route, options) {
options = _.defaults({
@matt40k
matt40k / Enable_CDC_On_All_Tables.sql
Created Sep 25, 2015
Enable CDC on all tables - Author: Rasmus Reinholdt Nielsen
View Enable_CDC_On_All_Tables.sql
USE [master]
GO
ALTER DATABASE [{{DATABASE-NAME}}]
ADD FILEGROUP CDC;
GO
ALTER DATABASE [{{DATABASE-NAME}}] ADD FILE
( NAME = N'{{DATABASE-NAME}}_CDC'
, FILENAME = N'{{SQL-DATA}}\MSSQL\DATA\{{DATABASE-NAME}}_cdc.MDF'
@lsloan
lsloan / Open Selected Finder Folder in iTerm
Last active Sep 13, 2017 — forked from al3xandru/gist:1156476
Use the selected folder in Finder to open a shell in iTerm and go to its directory.
View Open Selected Finder Folder in iTerm
Gist title: "Open Selected Finder Folder in iTerm"
Summary: Use the selected folder in Finder to open a shell in iTerm and go to its directory.
See also: https://gitlab.com/gnachman/iterm2/issues/3552