Skip to content

Instantly share code, notes, and snippets.

View aregee's full-sized avatar
🎯
“continuously refactoring towards deeper insight”

Rahul Gaur aregee

🎯
“continuously refactoring towards deeper insight”
View GitHub Profile
from django.http import HttpResponse
from tastypie import http
from tastypie.exceptions import ImmediateHttpResponse
from tastypie.resources import convert_post_to_put
class PublicEndpointResourceMixin(object):
""" Public endpoint dispatcher, for those routes upon which you don't want
to enforce the current resources authentication limits."""
class ProfileResource(ModelResource):
user = fields.ForeignKey(UserResource, 'user')
def prepend_urls(self):
urls = [
url(r'^(?P<resource_name>%s)/(?P<username>[\w\d_.-]+)/$' %\
self._meta.resource_name, self.wrap_view('user_by_username'),
name='profile_user_by_username')
]
return urls
@aregee
aregee / diff.sh
Last active August 29, 2015 14:02
MASTER=`git log --pretty=format:'%H' develop | sort`
DEV=`git log --pretty=format:'%H' feature/uiv2-develop | sort`
for i in `diff <(echo "${MASTER}") <(echo "${DEV}") | grep '^>' | sed 's/^> //'`;
do
git --no-pager log -1 --oneline $i;
done
angular.module('ngApp')
.service('modalService', ['$modal',
function ($modal) {
// Default options for Modal window Options
var modalOptions = {
closeButtonText: 'Close',
actionButtonText: 'OK',
headerText: 'Proceed?',
bodyText: 'Perform this action?',
value: {},
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
AWS S3 Gzip compression utility
Author: Dmitriy Sukharev
Modified: 2013-09-11
-------
Synchronizes directory with gzipped content of Amazon S3 bucket with local
#!/bin/bash
while read oldrev newrev ref
do
if [[ $ref =~ .*/master$ ]];
then
echo "Master ref received. Deploying master branch to production..."
git --work-tree=/home/ubuntu/node-frankly --git-dir=/home/ubuntu/development checkout -f
changedfiles=( `git diff-tree --no-commit-id --name-only master` )
/*
* Calaca - Search UI for Elasticsearch
* https://github.com/romansanchez/Calaca
* http://romansanchez.me
* @rooomansanchez
*
* v1.2.0
* MIT License
*/
/*global PushStream WebSocketWrapper EventSourceWrapper EventSource*/
/*jshint evil: true, plusplus: false, regexp: false */
/**
The MIT License (MIT)
Copyright (c) 2010-2014 Wandenberg Peixoto <wandenberg@gmail.com>, Rogério Carvalho Schneider <stockrt@gmail.com>
This file is part of Nginx Push Stream Module.
Permission is hereby granted, free of charge, to any person obtaining a copy
@aregee
aregee / json_pagination.sql
Last active March 15, 2023 12:23 — forked from fritzy/json_pagination.sql
Getting JSON paginated results of a table SELECT
SELECT json_build_object(
'total', (SELECT n_live_tup FROM pg_stat_user_tables WHERE relname='sometable'),
'count', count(sometable_rows.*),
'offset', 0,
'results', json_agg(row_to_json(sometable_rows))
)
FROM (SELECT * FROM test_log_clj)
ORDER BY "time"
LIMIT 10 OFFSET 0)
sometable_rows;
pid logs/nginx.pid;
error_log logs/nginx-main_error.log debug;
# Development Mode
master_process off;
daemon off;
worker_rlimit_core 2500M;
working_directory /tmp;
debug_points abort;
env MOCKEAGAIN_VERBOSE;