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
// function name and parameters to pass | |
var fnstring = "customFunc"; | |
var fnparams = [1, 2, 3]; | |
// find object | |
var fn = window[fnstring]; | |
// is object a function? | |
if (typeof fn === "function") fn.apply(null, fnparams); |
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 QueryString = function () | |
{ | |
// This function is anonymous, is executed immediately and | |
// the return value is assigned to QueryString! | |
var query_string = {}; | |
var query = window.location.search.substring(1); | |
var vars = query.split("&"); | |
for (var i=0;i<vars.length;i++) | |
{ |
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
//Converte sequência de caracteres ANSI para UTF-8 e vice-versa. | |
//http://jsfromhell.com/pt/geral/utf-8 | |
var UTF8 = { | |
encode: function(s){ | |
for(var c, i = -1, l = (s = s.split("")).length, o = String.fromCharCode; ++i < l; | |
s[i] = (c = s[i].charCodeAt(0)) >= 127 ? o(0xc0 | (c >>> 6)) + o(0x80 | (c & 0x3f)) : s[i] | |
); | |
return s.join(""); | |
}, | |
decode: function(s){ |
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 types = { | |
'get': function(prop) { | |
return Object.prototype.toString.call(prop); | |
}, | |
'object': '[object Object]', | |
'array': '[object Array]', | |
'string': '[object String]', | |
'boolean': '[object Boolean]', | |
'number': '[object Number]' | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Box Shadow</title> | |
<style> | |
.box { | |
height: 150px; | |
width: 300px; | |
margin: 20px; |
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
#parent{ | |
height: 100%; | |
width: 100%; | |
overflow: hidden; | |
} | |
#child{ | |
width: 100%; | |
height: 100%; | |
overflow: auto; |
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
NSString *roboto_font = @"Roboto-Regular"; | |
UITextField *input_login = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, 320, 20)]; | |
input_login.alpha = 0.1f; | |
input_login.textAlignment = NSTextAlignmentCenter; | |
input_login.textColor = [UIColor whiteColor]; | |
input_login.layer.shadowColor = [[UIColor blackColor] CGColor]; | |
input_login.layer.shadowOffset = CGSizeMake(1.0f, 1.0f); | |
input_login.layer.shadowOpacity = 1.0f; | |
input_login.layer.shadowRadius = 1.0f; | |
input_login.font = [UIFont fontWithName:roboto_font size:15]; |
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
//source: https://coderwall.com/p/zz5ieg/rgb-to-uicolor | |
#define rgb(R,G,B) [UIColor colorWithRed:R/255.0f green:G/255.0f blue:B/255.0f alpha:1.0] | |
#define rgba(R,G,B,A) [UIColor colorWithRed:R/255.0f green:G/255.0f blue:B/255.0f alpha:A] | |
mylabel.textColor = rgb(231, 76, 60); | |
myview.backgroundColor = rgba(231, 76, 60,0.2); | |
// Alpaha value max is 1 and min is 0 , you must use float point |
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
//Add UITextFieldDelegate in Controller | |
@interface ViewController : UIViewController<UITextFieldDelegate> | |
UITapGestureRecognizer *tapRecognizer; | |
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; | |
[nc addObserver:self selector:@selector(keyboardWillShow:) name: | |
UIKeyboardWillShowNotification object:nil]; |
OlderNewer