Skip to content

Instantly share code, notes, and snippets.

View coquer's full-sized avatar

Jorge Y. C. Rodriguez coquer

View GitHub Profile
@coquer
coquer / add_margin_to_table_view.swift
Created September 8, 2015 10:25
Programmatically add margin to table view controller
override func viewDidLoad(){
super.viewDidLoad()
let isset: UIEdgeInsets = UIEdgeInsets(top: 75, left: 0, bottom: 0, right: 0)
self.tableView.contentInset = isset
}
@coquer
coquer / The Technical Interview Cheat Sheet.md
Last active August 26, 2015 10:47 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@coquer
coquer / wordpresChangeSenderEmail.php
Last active August 29, 2015 14:28
Change default sender email address wordpress, This includes email being sent from a subdomains.
function setDefaultFromEmail(){
$url = "";
$parse = parse_url(home_url());
if (strpos($parse['host'], 'www') !== false) {
$url = preg_replace('#^www\.(.+\.)#i', '$1', $parse['host']);
}else{
$url = $parse['host'];
}
$array = explode(".", $url);
$uri = (array_key_exists(count($array) - 2, $array) ? $array[count($array) - 2] : "").".".$array[count($array) - 1];
<?php
/**
* Created by IntelliJ IDEA.
* User: jycr753
* Date: 8/11/15
* Time: 11:54 PM
*/
include_once('APIExternalContentUpdater.php');
include_once('DatabaseController.php');
@coquer
coquer / hack.py
Last active August 29, 2015 14:25 — forked from ttsiodras/hack.py
I just did something that depending on your viewpoint on coding, is either an insult to God and humanity, or absolutely brilliant.
#
# I inherited a large code base, where hundreds of code paths end up
# calling "common_function_called_in_gazillion_places".
#
# And the need arose for this function to access the HTTP request's
# headers...
#
# What to do? Refactor all the places leading up to here? In a dynamically
# typed language, with no compiler to tell us the places to refactor?
#
@coquer
coquer / main.js
Created June 4, 2015 15:54
Simple Widget
function proccessContent(){
/**
* Read JSON file to include as script
* @return {[void]} triggers function to populate content
*/
this.readFile = function (){
if (window.File && window.FileReader && window.FileList && window.Blob) {
var json_file_url = "http://blog.jorgerodriguez.dk/wp-content/themes/jycr753/json/reviews.json";
$.ajax({
window.onscroll = function(){
var _postion_top = document.documentElement.scrollTop || document.body.scrollTop,
_header_element = document.getElementById('site-navigation'),
class_name = "box_shadow";
console.log("poss - > " + _postion_top);
if(_postion_top > 340){
if (_header_element.classList){
_header_element.classList.add(class_name);
} else{
@coquer
coquer / functions.php
Last active August 29, 2015 14:22
simple form wordpress
function createShortCut() {
ob_start();
generateFormHTMLCode();
doTheThing();
return ob_get_clean();
}
function generateFormHTMLCode(){
?>
<div class="front-get-one-form">
<?php
function blobR($pattern, $flags){
$files = glob($pattern, $flags);
foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir){
$files = array_merge($files, blobR($dir.'/'.basename($pattern), $flags));
}
return $files;
}
@coquer
coquer / markdown.css
Last active August 29, 2015 14:19 — forked from imjasonh/markdown.css
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}