Skip to content

Instantly share code, notes, and snippets.

class ApplicationController < ActionController::Base
protect_from_forgery
def after_sign_in_path_for(resource_or_scope)
if current_user.sign_in_count == 1
new_when_path
else
root_path
end
http://localhost:3000/locate/12/06/12/2012 returns as 2012-12-06
WANT IT TO RETURN AS
06-12-2012
======CONTROLLER====
This is the data i want ot use
{
"device":118,
"events":[{
"exampleentry":7,
"exampleentry":118,
"exampleentry":13
"exampleentry":xxx,
"location":{
@WassifAziz
WassifAziz / gist:3053975
Created July 5, 2012 14:25
arduino send text code - every 5 minutes roughly
/*Kitchen Sink App*/
/*shows number of texts sent in serial monitor*/
// libraries
#include <GSM3SMSService.h>
#include <GSM3ShieldV1AccessProvider.h>
#include <GSM3ShieldV1ClientProvider.h>
#include <GSM3ShieldV1SMSProvider.h>
#include <GSM3MobileClientService.h>
@WassifAziz
WassifAziz / gist:3053973
Created July 5, 2012 14:25
arduino send text code
/*Kitchen Sink App*/
// libraries
#include <GSM3SMSService.h>
#include <GSM3ShieldV1AccessProvider.h>
#include <GSM3ShieldV1ClientProvider.h>
#include <GSM3ShieldV1SMSProvider.h>
#include <GSM3ShieldV1DataNetworkProvider.h>
#include <GSM3MobileClientService.h>
@WassifAziz
WassifAziz / gist:3047904
Created July 4, 2012 15:32
Arduino GSM Shield HTTP request
// (c) Copyright 2010-2011 MCQN Ltd.
// Released under Apache License, version 2.0
//
// Simple example to show how to use the HttpClient library
// Get's the web page given at http://<kHostname><kPath> and
// outputs the content to the serial port
// The example is adapted to run on the GSM/GPRS shield
// in asynchronous mode
//
// Circuit:
@WassifAziz
WassifAziz / gist:3047895
Created July 4, 2012 15:28
Arduino GSM HTTP request
// (c) Copyright 2010-2011 MCQN Ltd.
// Released under Apache License, version 2.0
//
// Simple example to show how to use the HttpClient library
// Get's the web page given at http://<kHostname><kPath> and
// outputs the content to the serial port
// The example is adapted to run on the GSM/GPRS shield
// in asynchronous mode
//
// Circuit:
/*
ReadAnalogVoltage
Reads an analog input on pin 0, converts it to voltage, and prints the result to the serial monitor.
Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
This example code is in the public domain.
*/
// the setup routine runs once when you press reset:
void setup() {
Trying to get it to display hello if the minutes are set to 23 in the controller. (Not sure of doing it right)
index.html.erb
<% if @minutes == 23 %>
<%= "helllo" %>
<% else %>
def index
@minutes = params[:minutes]
@minutes = 500
if minutes <= 500
p "you have used under 500 minutes"
else
p "you have used over 500 minutes"
end
end