Skip to content

Instantly share code, notes, and snippets.

View rcerrejon's full-sized avatar

Rafael Cerrejon rcerrejon

View GitHub Profile
@rcerrejon
rcerrejon / enconder.m
Last active April 5, 2017 15:25
NSString to URL Encode in Objective-C
// NSString to URL Encode
NSString *originalString = [NSString stringWithFormat:@"Hallo Welt"];
NSString *stringURLEncoded = [originalString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
@rcerrejon
rcerrejon / goTo.m
Last active April 5, 2017 15:25
Go to a Segue in Storyboard (programatically) in Objective-C
//Go to Segue
[self performSegueWithIdentifier: @"nameOfYourSegueIdentifier" sender: self];
@rcerrejon
rcerrejon / constant.m
Last active April 5, 2017 15:24
NSUserDefaults template in Objective-C
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:variable forKey:@"myVar"];
[defaults synchronize];
@rcerrejon
rcerrejon / umlaut.sql
Last active February 28, 2020 17:17
Database replace bad characters to german (umlaut) characters
/*Database replace bad characters to german characters (SQL)*/
/*replace "pages" with yout table and "title" with your field*/
UPDATE pages SET title=replace(title,'ß', 'ß'), title=replace(title, 'ä', 'ä'), title=replace(title, 'ü', 'ü'), title=replace(title, 'ö', 'ö'), title=replace(title, 'Ä', 'Ä'), title=replace(title, 'Ãœ', 'Ü'), title=replace(title, 'Ö', 'Ö'), title=replace(title, '€', '€'), title=replace(title, '–', '–'), title=replace(title, '“', '“'), title=replace(title, '„', '„'), title=replace(title, '§', '§');
@rcerrejon
rcerrejon / Controller.php
Last active June 8, 2016 09:57
Debug: "An error occurred while trying to call Vendor\ExtKey\Controller\ModelController->showAction()"
protected function errorAction() {
echo 'ErrorAction';
$this->clearCacheOnError();
if ($this->configurationManager->isFeatureEnabled('rewrittenPropertyMapper')) {
echo 'Rewritten Property Mapper';
echo '<pre>';
foreach ($this->arguments->getValidationResults()->getFlattenedErrors() as $propertyPath => $errors) {
foreach ($errors as $error) {
$message .= 'Error for ' . $propertyPath . ': ' . $error->render() .
@rcerrejon
rcerrejon / script.js
Created February 11, 2016 10:39
Simple Tabs in Jquery
$(document).ready(function() {
$(".tabLink").each(function(){
$(this).click(function(){
tabeId = $(this).attr('id');
$(".tabLink").removeClass("activeLink");
$(this).addClass("activeLink");
$(".tabcontent").addClass("hide");
$("#"+tabeId+"-1").removeClass("hide");
return false;
});
@rcerrejon
rcerrejon / style.css
Created February 11, 2016 10:54
Borderbox with Shadows
/* Border box with shadows */
div {
border-radius: 3px;
box-shadow: 0 1px 5px #888;
}
/* Another 4 sides box shadow */
div {
border-radius: 6px;
box-shadow: 0px 0px 8px 4px #CCCCCC;
@rcerrejon
rcerrejon / centeredIcon.css
Created February 11, 2016 11:30
Background absolute center horizontal and vertical
/* CSS in order to center an element (with position absolute) in a container: */
.centeredIcon {
background: url("http://www.google.com/favicon.ico") no-repeat transparent;
width:64px;
height:64px;
position:absolute;
left:50%;
top:50%;
margin-left:-32px; /* half of the width */
@rcerrejon
rcerrejon / randomizer.sql
Created February 11, 2016 11:31
Random Number between 1-10 (with no 0)
FLOOR( 1 + RAND( ) *10 )
@rcerrejon
rcerrejon / plugin.js
Last active June 8, 2016 09:57
DataTables Table plug-in for jQuery: http://www.datatables.net/
//DataTables Table plug-in for jQuery: http://www.datatables.net/