This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<companies type="array"> | |
<company> | |
<created-at type="datetime">2013-05-04T18:05:09Z</created-at> | |
<id type="integer">2</id> | |
<name>There we go</name> | |
<updated-at type="datetime">2013-05-04T18:40:45Z</updated-at> | |
</company> | |
<company> | |
<created-at type="datetime">2013-05-04T18:14:23Z</created-at> | |
<id type="integer">5</id> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GET /companies/1 | |
# GET /companies/1.json | |
def show | |
@company = Company.find(params[:id]) | |
respond_with @company | |
end | |
# POST /companies | |
# POST /companies.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="field"> | |
<%= f.label :category_id %><br /> | |
<%= f.collection_select :category_id, @categories, :id, :name %> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tasks for managing Unicorn instances of a Rails application. | |
# Compatible with Ruby >= 1.9.2 and Rails >= 2 . | |
# Unicorn signals: http://unicorn.bogomips.org/SIGNALS.html | |
namespace :unicorn do | |
class UnicornPIDError < StandardError; end | |
def rails_env | |
Rails.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var url = "http://bot.whatismyipaddress.com/"; | |
var request = WebRequest.Create(url); | |
var res = (HttpWebResponse)request.GetResponse(); | |
var reader = new StreamReader(res.GetResponseStream()); | |
string ip = reader.ReadToEnd(); | |
return ip; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ps aux | grep unicorn | |
kill 39504 <=== replace with master's id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Quick port of the function used here to detect the credit card type: | |
// http://webstandardssherpa.com/reviews/auto-detecting-credit-card-type | |
public static string GetCardType(string Number) | |
{ | |
//start without knowing the credit card type | |
var result = "unknown"; | |
//first check for MasterCard | |
if (Regex.Match(Number, @"^5[1-5]").Success) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<WhateverYourClientReturns> GetData() | |
{ | |
var dataClient = new DataAccessLayerClient(); | |
Task<WhateverYourClientReturns> getData = client.GetData(); | |
// Esto de aquí se ejecuta en lo que el hacha va y viene | |
var form = new Frm_Custom_MessageBox(); | |
form.ShowDialog(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RaygunErrorHandlerAttribute.cs | |
using System.Web.Mvc; | |
using Microsoft.WindowsAzure; | |
using Mindscape.Raygun4Net; | |
namespace MyProject.Attributes | |
{ | |
public class RaygunErrorHandlerAttribute : HandleErrorAttribute | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ActionResult GetTokenFromThinkTecture() | |
{ | |
var form = new FormUrlEncodedContent( | |
new Dictionary<string, string> | |
{ | |
{OAuth2Constants.GrantType, OAuth2Constants.Password}, | |
{OAuth2Constants.UserName, "user}, | |
{OAuth2Constants.Password, "password"}, | |
{OAuth2Constants.Scope, "https://localhost:44300/OAuth"} | |
}); |