Skip to content

Instantly share code, notes, and snippets.

View chukitow's full-sized avatar

Ivan velasquez chukitow

View GitHub Profile
/* HAML */
#navbar
%nav.navbar.navbar-default.navbar-static-top{ role:"navigation"}
.container-fluid
.navbar-header
%button.navbar-toggle{ type: "button", "data-toggle"=>"collapse", "data-target"=>"#bs-example-navbar-collapse-1" }
%span.sr-only
Toggle navigation
%span.icon-bar
%span.icon-bar
@chukitow
chukitow / default view controller IOS
Created August 24, 2014 01:06
Modify root view controller IOS
KHViewController *rootView = [[KHViewController alloc]initWithNibName:@"KHViewController" bundle:nil];
UINavigationController *navigation = [[UINavigationController alloc]initWithRootViewController:rootView];
self.window.rootViewController = navigation;
$(function() {
/* variables */
var status = $('.status');
var percent = $('.percent');
var bar = $('.bar');
/* submit form with ajax request using jQuery.form plugin */
$('form').ajaxForm({
/* set data type json */
/* Sticky footer styles
-------------------------------------------------- */
html {
position: relative;
min-height: 100%;
}
body {
/* Margin bottom by footer height */
margin-bottom: 100px;
}
@chukitow
chukitow / IMAGELOADER
Last active August 29, 2015 14:02
Uso basico de la libreria image loader de android
/*Los objetos*/
ImageLoader imageLoader;
DisplayImageOptions options;
/*Iniciarlos*/
imageLoader = ImageLoader.getInstance();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
.build();
imageLoader.init(config);
#include <18F4520.h>
#device adc = 10
#fuses XT, PUT, NODEBUG , NOBROWNOUT , NOPROTECT , NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, bits = 8 , parity = N ,xmit=PIN_C6,rcv=PIN_C7)
#include <ds1307.c>
float temperatura;//Variable que almacenara la temperatura;
boolean timerFired=false;//bandera para disparar el timer
#include <18f4520.h>
#fuses XT, NOWDT, PUT, NODEBUG, NOBROWNOUT, NOPROTECT, NOLVP, NOWRT
#use delay(clock=4000000)
#include<ds1307.c>
#use rs232(baud=9600, bits = 8 , parity = N ,xmit=PIN_C6,rcv=PIN_C7)
int ch;
int timer=0;
int segundos=0;
int minutos=0;
/************************************************/
/*PIN_B0 FOCO 1 */
/*PIN_B1 FOCO 2 */
/*PIN_B2 SENSADO FOCO 1 */
/*PIN_B3 SENSADO FOCO 2 */
/*PIN_B4 VENTANA 1 */
/*PIN_B5 VENTANA 2 */
/*PIN_B6 PUERTA 1 */
/*PIN_B6 PUERTA 2 */
/************************************************/
@picture = params[:picture] #form data
directory = "photos" #path destination
path = File.join(directory,@picture.original_filename) #join the name "pathdestination/filename.extension"
File.open(path, "wb") { |f| f.write(@picture.read) } #save the file
redirect_to root_path
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_filter :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_up) << :username