Skip to content

Instantly share code, notes, and snippets.

View amscotti's full-sized avatar
😀

Anthony Scotti amscotti

😀
View GitHub Profile
require "rubygems"
require "twitter"
require 'geokit'
username = "amscotti"
friends_list = Twitter.friends(username)
friends_list.users.each do |friend|
puts "----------------------------"
unless friend.location.nil? || friend.location.strip.empty?
@amscotti
amscotti / dateFormat_parse.dart
Created April 24, 2013 11:14
Throws FormatException, Input DateTime is 2013-04-24 07:12:25.516, which formats to 201304240712 FormatException: Trying to read MM from 201304240712 at position 12
import 'package:intl/intl.dart';
void main() {
var dateFormat = new DateFormat("yyyyMMddHHmm");
DateTime now = new DateTime.now();
String strDate = dateFormat.format(now);
print("Input DateTime is ${now}, which formats to ${strDate}");
try {
import 'package:http/http.dart' as http;
import 'dart:json' as JSON;
import 'package:intl/date_symbol_data_local.dart';
import 'package:intl/intl.dart';
DateTime getDate(String input) {
var dateFormat = new DateFormat("yyyyMMddHm");
return dateFormat.parse(input);
}
jQuery(function($) {
function gotAssertion(assertion) {
// got an assertion, now send it up to the server for verification
if (assertion !== null) {
$.ajax({
type: 'POST',
url: '/auth/login',
data: { assertion: assertion },
success: function(res, status, xhr) {
window.location.reload();
#!/bin/bash
# declare variables
SERVER="<SERVER IP/NAME>"
USER="<YOU USER NAME>"
INNER_IP="<IP OF THE SYSTEM YOU WANT TO CONNECT TO>"
PORT="<PORT YOU  WANT TO USE>"
#print variable on a screen
echo Connecting to $SERVER and opening $PORT to $INNER_IP
ssh $USER@$SERVER -CNL $PORT:$INNER_IP:$PORT`
require 'rubygems'
require 'em-websocket'
require 'yajl'
require 'haml'
require 'sinatra/base'
require 'thin'
EventMachine.run do
class App < Sinatra::Base
get '/' do
require 'rubygems'
require "aws-sdk"
require "yaml"
#To load the configuration file
CONFIG = YAML.load_file("config.yml") unless defined? CONFIG
#This is for Foreman can properly get the output.
$stdout.sync = true
@amscotti
amscotti / server.js
Last active December 15, 2015 09:09
Proxy server for working with Yeoman and a REST API. Install http-proxy by running 'npm install http-proxy' or add to your package.json and run 'npm install'
var httpProxy = require('http-proxy'),
staticDir = 'app',
apiHost = '<Your API Host>',
apiPort = 80,
apiPath = '/api';
var proxy = new httpProxy.RoutingProxy();
connect()
.use(connect.logger("dev"))
.use(function (req, res, next) {
aws = require ('aws-lib')
access_key_id = "<Your access key id>"
secret_access_key = "<Your secret access key>"
options = {
"path" : "<Your queue URL, just the /accountid/queue_name is needed>"
}
sqs = aws.createSQSClient(access_key_id, secret_access_key, options)
@amscotti
amscotti / node_send.coffee
Created June 3, 2012 17:24
Amazon's Simple Queue Service with Node.js and Ruby - http://bit.ly/Nwn0Q1
aws = require ('aws-lib')
access_key_id = "<Your access key id>"
secret_access_key = "<Your secret access key>"
options = {
"path" : "<Your queue URL, just the /accountid/queue_name is needed>"
}
sqs = aws.createSQSClient(access_key_id, secret_access_key, options)