Skip to content

Instantly share code, notes, and snippets.

View frangeris's full-sized avatar
👀

Frangeris Peguero frangeris

👀
  • Cloud(x);
  • Buenos Aires
  • 08:29 (UTC -03:00)
View GitHub Profile
@satya164
satya164 / MainActivity.java
Last active December 2, 2016 20:03
react-native-fbsdk in React Native 0.29.+
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "MyApp";
}
@Simbul
Simbul / pre-commit
Created February 9, 2012 18:06
Git hook to prevent commits on a staging/production branch
#!/usr/bin/env ruby
# This pre-commit hook will prevent any commit to forbidden branches
# (by default, "staging" and "production").
# Put this file in your local repo, in the .git/hooks folder
# and make sure it is executable.
# The name of the file *must* be "pre-commit" for Git to pick it up.
FORBIDDEN_BRANCHES = ["staging", "production"]
@Kindari
Kindari / gist:3879716
Created October 12, 2012 15:19
Laravel Filter Route based on Role
<?php
Route::get('protected', array('before' => 'auth|role:admin', function() {
return "Only admins can see this";
}));
Route::filter('role', function ($role) {
if ( ! Auth::user()->has_role( $role ) )
{
return Response::error("401"); // not authorized
@raplos
raplos / gist:6560810
Last active April 15, 2019 15:07
ajax-answer for ajax-request in phalcon base controller
public function afterExecuteRoute($dispatcher) {
$is_ajax = isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
if ($is_ajax) {
$this->view->disableLevel(\Phalcon\Mvc\View::LEVEL_MAIN_LAYOUT);
$eventsManager = new \Phalcon\Events\Manager();
$eventsManager->attach('view:afterRender', function ($event, $view) {
$view->setContent(json_encode(array(
'content' => $view->getContent(),
@cowboy
cowboy / jsonp.php
Created September 7, 2011 14:28
JSONP "callback" param explanation, via basic PHP script.
<?PHP
# JSONP "callback" param explanation, via basic PHP script.
#
# "Cowboy" Ben Alman
# http://benalman.com/
# Set $data to something that will be serialized into JSON. You'll undoubtedly
# have your own code for this.
$data = array("some_key" => "some_value");
@megahertz
megahertz / MobxRnnProvider.js
Last active January 11, 2020 09:56
This is a provider which allows to use mobx-react Provider with wix/react-native-navigation.
import { Provider } from 'mobx-react/native';
const SPECIAL_REACT_KEYS = { children: true, key: true, ref: true };
export default class MobxRnnProvider extends Provider {
props: {
store: Object
};
context: {
@rmoff
rmoff / gist:379e6ce46eb128110f38
Last active August 14, 2020 18:39
Kibana 3 and Elasticsearch 1.4 - CORS problem

Kibana 3 against ElasticSearch 1.4 throws an Connection Failed screen. The error text says to set http.cors.allow-origin, but it misses out the important http.cors.enabled: true

Working config:

$ grep cors elasticsearch-1.4.0.Beta1/config/elasticsearch.yml
http.cors.allow-origin: "/.*/"
http.cors.enabled: true
@davideast
davideast / push.js
Last active April 20, 2021 17:19
Send push notifications with node-apn and Firebase
var apn = require("apn");
var Firebase = require("firebase");
var service = new apn.connection({ production: false }); // true for production pipeline
// Create a reference to the push notification queue
var pushRef = new Firebase("<your-firebase>.firebaseio.com/notificationQueue");
// listen for items added to the queue
pushRef.on("child_added", function(snapshot) {
@teohm
teohm / learn-dynamodb.md
Last active July 31, 2021 09:55
personal reading notes about DynamoDB tips & gotcahs

Disclaimer: I'm super new to DynamoDB, so if you found I wrote something incorrect or stupid, just kindly send me a comment :)


Learn DynamoDB

  • database -> tables -> items -> attributes
  • db = a collection of tables
@frangeris
frangeris / commands.md
Last active December 6, 2021 20:15
Common git commands

Common git commands

This is a list of useful commands for git for fast search and ops developers, enjoy and comments for suggest all welcomes :D


Public repo .tar for download versions: https://www.kernel.org/pub/software/scm/git/