Skip to content

Instantly share code, notes, and snippets.

View sirianni's full-sized avatar

Eric Sirianni sirianni

View GitHub Profile
@mlynch
mlynch / auth.markdown
Last active September 4, 2020 18:11
AngularJS Authentication and CORS

Single Page Apps are ruling the world and AngularJS is leading the charge. But many of the lessons we learned in the Web 2.0 era no longer apply, and few are as drastically different as authentication.

CORS

CORS is an oft-misunderstood feature of new browsers that is configured by a remote server. CORS stands for Cross-Origin-Resource-Sharing, and was designed to make it possible to access services outside of the current origin (or domain) of the current page.

Like many browser features, CORS works because we all agree that it works. So all major browsers like Chrome, Firefox, and IE support and enforce it. By using these browsers, you benefit from the security of CORS.

That means certain browsers do not enforce it, so it is not relevant there. One large example is a native Web View for things like Cordova and Phonegap. However, these tools often have configuration options for whitelisting domains so you can add some security that way.

@jasoncrawford
jasoncrawford / routing.js
Last active November 23, 2018 15:12
Backbone flash mechanism
var Backbone = require('backbone');
// Flash ///////////////////////////////////////////////////////////////////////////////////////////
// The flash is a way for one controller to pass a small amount of information to the next
// controller, through a navigation event.
//
// The flash holds arbitrary parameters, and is cleared by the router after each navigation event.
var flash = exports.flash = {
params: {},
<!doctype html>
<!-- I ran with php -S localhost:3007 -->
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<script src="./angular.js"></script>
@willurd
willurd / web-servers.md
Last active August 5, 2025 00:46
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active July 31, 2025 21:28
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@latentflip
latentflip / gist:3722894
Created September 14, 2012 16:04
Off the cuff ember and backbone thoughts from a non-expert.

Some very off the cuff thoughts on ember and backbone

Here's where I am at with things for Float:

  • done a load of stuff with backbone, and it's what we use in production
  • played with ember, but nothing too serious. Thinking it might be good for Float, but it's got a steep learning curve initially, so it may never happen.

Having read http://trek.github.com and worked through the examples, and compared it to what I've done in backbone. My thoughts are:

@deinspanjer
deinspanjer / BulkLoadTester.java
Created September 5, 2012 20:59
Quick and dirty tester for different Vertica bulk load methods
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;