Skip to content

Instantly share code, notes, and snippets.

View gon250's full-sized avatar
💃
I may be slow to respond.

Gonzalo gon250

💃
I may be slow to respond.
View GitHub Profile
@gon250
gon250 / ErrorBoundary.tsx
Created July 18, 2022 12:56
[Nextjs] ErrorBoundary
import React, {Component, ErrorInfo, ReactNode} from 'react';
import {CustomError} from '@components/error/custom.error';
interface Props {
children?: ReactNode;
}
interface State {
hasError: boolean;
@gon250
gon250 / .bashrc
Created December 26, 2019 08:31
My personal .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@gon250
gon250 / gulpfile.js
Created October 27, 2016 16:12
Typescript + gulp
var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var tsify = require('tsify');
var sourcemaps = require('gulp-sourcemaps');
var buffer = require('vinyl-buffer');
var paths = {
pages: ['src/*.html']
};
import React from 'react';
import Reflux from 'reflux';
import SocialStore from '../stores/socialStore';
import Card from './shared/card.js'
var Social = React.createClass({
mixins: [Reflux.connect(SocialStore, 'socialstore')],
render: function() {
@gon250
gon250 / app.js
Last active October 7, 2015 14:26
Basic settings for react-router
/*
* Module dependencies
*/
import React from 'react';
import { Router, Route, Link } from 'react-router'
class App extends React.Component {
render(){
@gon250
gon250 / GetJsonDeserializer.cs
Created September 30, 2015 15:51
Deserialize json example
public RootObject GetJsonDeserializer(string json)
{
try
{
JsonDataSession = (RootObject)JsonConvert.DeserializeObject(json, typeof(RootObject), new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.Auto,
NullValueHandling = NullValueHandling.Ignore,
MissingMemberHandling = MissingMemberHandling.Ignore,
Error = (serializer, err) =>
@gon250
gon250 / gist:2664b477a86e9df187d1
Last active September 21, 2015 11:44
X-Frame-Options
public override void OnActionExecuting(ActionExecutingContext context)
{
var siteId = this._siteDataProvider.GetSiteId(context.HttpContext.Request.Url.Host);
HttpResponseBase response = context.HttpContext.Response;
string userAgent = context.HttpContext.Request.UserAgent;
if (userAgent.Contains("MSIE 8") || userAgent.Contains("MSIE 9"))
{
switch (siteId)
{
case (int)SiteEnum.A:
@gon250
gon250 / web.config
Created August 6, 2015 10:36
Enable cors domain in the web.config
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Content-Type" />
<add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" />
</customHeaders>
</httpProtocol>
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
import com.samsung.android.sdk.gesture.Sgesture;
import com.samsung.android.sdk.gesture.SgestureHand;
import android.os.Looper;
public class GestureHand {
public static int UP = 1;
public static int DOWN = 2;
public static int LEFT = 3;