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 / IntroductionToObject-OrientedJavaScriptExample.js
Created May 18, 2015 13:14
Introduction To Object-Oriented JavaScript Example
(function ($) {
var APP = function () {
this.permanentId = $('.permanentId');
this.table = $('table');
this.lockButton = $('.btn-lock');
};
APP.prototype.start = function () {
var self = this;
this.permanentId.on("click", function () {
@gon250
gon250 / baseAjaxCall.js
Created July 8, 2015 13:49
Base Ajax Call
//My answer Stackoverflow
// http://stackoverflow.com/a/30301335/2545964
function baseAjaxCall(option, sCb) {
var ajaxOptions = {
method: option.method || "GET",
url: option.url,
dataType: option.dataType || "xml",
success : function(data) {
var root = $($.parseXML(data)).find("Response");
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;
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
@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>
@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 / 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 / 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(){
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 / 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']
};