Skip to content

Instantly share code, notes, and snippets.

View geordee's full-sized avatar
🔥

Geordee Naliyath geordee

🔥
View GitHub Profile
@geordee
geordee / generic_datatable.rb
Created February 23, 2014 16:54
A generic data table class to support rendering DataTables from remote. Most of the code from RailsCasts #340 (http://railscasts.com/episodes/340-datatables). Inherit this class and override the columns, records and data methods.
class GenericDatatable
delegate :params, :h, :link_to, :raw, to: :@view
def initialize(view, records)
@view = view
@records = records
end
def as_json(options = {})
{
# Assumptions:
* Rails 3.2.x
* nginx
* capistrano deploy
* "X-Accel-Mapping header missing" messages in nginx error.log file
* You want to serve static files with nginx instead of Rails
# nginx configuration:
@geordee
geordee / styles.less
Created April 11, 2014 08:33 — forked from staydecent/styles.less
Compact Tab Bar for Atom Editor
.tab-bar {
height: 32px;
padding: 0;
.tab {
-webkit-transform: none;
top: 1px;
left: 2px;
line-height: 25px;
@geordee
geordee / Gemfile
Created June 10, 2014 20:28
Rails 4 OmniAuth using Devise with Twitter, Facebook and Linkedin
gem 'devise'
gem 'omniauth'
gem 'omniauth-twitter'
gem 'omniauth-facebook'
gem 'omniauth-linkedin'
@geordee
geordee / es_ngram_analyzer.sh
Last active August 29, 2015 14:03
Elasticsearch nGram Analyzer
curl -XDELETE 'http://localhost:9200/alien'
curl -XPUT "http://localhost:9200/alien" -d'
{
"settings": {
"analysis": {
"filter": {
"index_ngram_filter": {
"type": "edgeNGram",
"min_gram": 2,
@geordee
geordee / elasticsearch.rake
Created July 8, 2014 05:05
Elasticsearch Schema Definition
namespace :elasticsearch do
desc 'Setup Elasticsearch index and mappings'
task :setup do
load('db/elasticsearch.rb')
end
end
#!/usr/bin/env python
import tweepy
from collections import Counter
consumer_key = 'consumer_key'
consumer_secret = 'consumer_secret'
access_token = 'access_token'
access_token_secret = 'access_token_secret'
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)

Keybase proof

I hereby claim:

  • I am geordee on github.
  • I am geordee (https://keybase.io/geordee) on keybase.
  • I have a public key whose fingerprint is B080 8F53 E444 1D52 1AEB EC98 F8C6 6936 5C6E 4DC6

To claim this, I am signing this object:

@geordee
geordee / unpivot.py
Created July 23, 2017 06:59
Unpivot a table using Python/Pandas
#!/usr/bin/env python
import os
import numpy
import pandas
xlsx = './workbook.xlsx'
df = pandas.read_excel(open(xlsx,'rb'), sheetname=0)
id_vars = ['Department', 'Category', 'Item']
@geordee
geordee / pivot.py
Created July 23, 2017 07:00
Pivot a table using Python/Pandas
#!/usr/bin/env python
import os
import numpy
import pandas
xlsx = './workbook.xlsx'
df = pandas.read_excel(open(xlsx,'rb'), sheetname=1)
df2 = pandas.pivot_table(df,