Skip to content

Instantly share code, notes, and snippets.

View raprav's full-sized avatar
🤓
[object Object]

Rafa Prats raprav

🤓
[object Object]
View GitHub Profile
@raprav
raprav / ip_blacklist.lua
Created May 28, 2018 17:18 — forked from chrisboulton/ip_blacklist.lua
Redis based IP blacklist for Nginx (LUA)
-- a quick LUA access script for nginx to check IP addresses against an
-- `ip_blacklist` set in Redis, and if a match is found send a HTTP 403.
--
-- allows for a common blacklist to be shared between a bunch of nginx
-- web servers using a remote redis instance. lookups are cached for a
-- configurable period of time.
--
-- block an ip:
-- redis-cli SADD ip_blacklist 10.1.1.1
-- remove an ip:
@raprav
raprav / gist:e5010e002494b976742f0c5692e8f539
Created June 21, 2016 11:37 — forked from jason-engage/gist:e072cc300fd789e8841e
Ionic Register Push Function Example with Payload and ionicPopup for Android and IOS
//Here is the curl commands I use to test - make sure you update the CAPSVARS. You can add an item ID Payload or not.
//For example if your app displays items, it can navigate to a specific item.
//If you want to add more state names, instead of only going to specific items:
//add another payload property called 'stateName'
//create a goState() function to accept a stateName as a parameter
//and modify the registerPush() to find the stateName property and pass into your goState().
//Android
curl -u YOURAPIKEY: -H "Content-Type: application/json" -H "X-Ionic-Application-Id: APPID" https://push.ionic.io/api/v1/push -d '{"tokens":["ANDROIDTOKEN"],"notification":{"alert":"I come from planet Ion.", "android":{"title":"This is a title2", "payload":{"sound":"notification.mp3","itemId":"7TF00hJI78Y"}}}}'
@raprav
raprav / backspacedirective
Created January 13, 2016 09:24 — forked from cstephe/backspacedirective
Angular directive: prevent backspace from acting like the back button
.directive('backSpaceNotBackButton', [function(){
return {
restrict: 'A',
link: function(scope, element, attrs){
// This will stop backspace from acting like the back button
$(element).keydown(function (e) {
var elid = $(document.activeElement)
.filter(
"input:not([type], [readonly]),"+
"input[type=text]:not([readonly]), " +