Skip to content

Instantly share code, notes, and snippets.

View abelmartin's full-sized avatar
😅

Abel Martin abelmartin

😅
  • Rhino
  • Washington, DC
View GitHub Profile
@abelmartin
abelmartin / application_controller.rb
Last active August 29, 2015 14:01
AngularJS CSRF token stuff
class ApplicationController < ActionController::Base
#Deailing with AngularJS CRSF issues
#...
protect_from_forgery with: :exception
after_action :set_ng_csrf_token
#...
protected
# Dealing with CSRF token issues.
import requests, json
from collections import Counter
districts = json.loads(requests.get('http://public-crest.eveonline.com/districts/').text)['items']
systems = {}
constellations = {}
s_times = {}
c_times = {}
@abelmartin
abelmartin / application.js
Created November 2, 2012 23:08
example of config files for requirejs-rails gem question
require([
'lib/dom_router',
'vendor/modernizr.custom.08494',
'jquery_ujs',
'lib/document-write-override'
], function(dom_router) {
dom_router.route({
//...
});
@abelmartin
abelmartin / gist:2203155
Created March 26, 2012 05:18
Alg for Rubyque question #
# For RubyQue question: http://rubeque.com/problems/home-on-the-range
def find_range
min = 0
default_max = 99
max = default_max
goal = 4494
while min <= max
current_sum = (1..100).to_a[min..max].reduce(:+)
if current_sum == 4494
def output name=((default=true); "caius")
puts "name: #{name.inspect}"
puts "default: #{default.inspect}"
end
output
# >> name: "caius"
# >> default: true
output "avdi"
@abelmartin
abelmartin / .vimrc
Created December 8, 2011 18:15
VIMRC: Insert a carriage return without entering insert mode
let mapleader=","
set nocompatible
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set nobackup
set nowritebackup
set history=50 " keep 50 lines of command line history
@abelmartin
abelmartin / irb3.rb
Created November 4, 2011 14:45 — forked from peterc/irb3.rb
irb3 - Run an IRB-esque prompt over multiple Ruby implementations at once using RVM
#!/usr/bin/env ruby
# encoding: utf-8
# irb3 - Runs an IRB-esque prompt (but it's NOT really IRB!) over multiple
# versions of Ruby at once (using RVM)
#
# By Peter Cooper, BSD licensed
#
# Main dependency is term-ansicolor for each impl:
# rvm exec gem install term-ansicolor
// myModule.js
var n = 100;
exports.getNumber = function(){}
exports.setNumber = function(){}
// app.js
var myMod = require('./myModule');
console.log(myMod.getNumber());
@abelmartin
abelmartin / ControllerSpec.js
Created May 14, 2011 22:09
My Jasmine Error
var MyC;
describe("MyC", function(){
beforeEach(function(){
// Load in the templates thanks to jasmine-jquery
loadFixtures("tmpl.html");
// Instantiates all of the views and sets up routes.
MyC = new MyController();
@abelmartin
abelmartin / Path Ping to JinglePunks.com
Created December 16, 2010 17:00
A quick path ping report to troubleshoot latency issues
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\jpmadmin>pathping jinglepunks.com
Tracing route to jinglepunks.com [67.23.14.32]
over a maximum of 30 hops:
0 jinglewin7 [192.168.0.141]
1 192.168.0.1
2 160.79.63.209