Skip to content

Instantly share code, notes, and snippets.

View MarcoPolo's full-sized avatar
🌠
Gradatim

Marco Munizaga MarcoPolo

🌠
Gradatim
View GitHub Profile
@MarcoPolo
MarcoPolo / sad.md
Created March 18, 2015 23:00
Shit ios devs say

On putting an .xib into storyboard

Add a new UIViewController to the storyboard. Remove its main view so that the view controller is empty. Set the Class of the view controller (in the Identity Inspector) to that of your nib's File's Owner. Also make sure the .h and .m files are added to your project already.

Now open the nib, select the top-most view and press Cmd-C to copy it to the clipboard. Switch to the storyboard, select that new, empty view controller. Press Cmd-V to paste the contents of the nib into this view controller.

You may have to reconnect all the outlets and actions, but at least you don't have to do the layout again. :-)

from

def can_we_go_to_bar(people_in_group):
able_to_drink = []
underage = []
for i in range(len(people_in_group)):
#Add to list if can drink and likes to
if people_in_group[i]['age'] >= 21 and people_in_group[i]['drinks'] == True:
able_to_drink.append(people_in_group[i])
else:
underage.append(people_in_group[i])
@MarcoPolo
MarcoPolo / gist:1277332
Created October 11, 2011 04:58
vignere in 25 lines of js
function encrypt(mess, key){
var i = (mess.length)/(key.length);
while (i>0){
key +=key;
i--;
}
key = key.substring(0, mess.length);
console.log('message is',mess)
console.log('key is',key.length);
Fatal error: Uncaught exception 'DB_Exception' with message 'Error performing MySQL query. Error message: "Table 'beluga.SongTimeSeries_Day_Streams_SongIDMod10Equals5' doesn't exist," error number: 1146, query: "SELECT value, TSDate date
FROM SongTimeSeries_Day_Streams_SongIDMod10Equals5
WHERE SongID = 32112155
AND TSDate BETWEEN '2011-07-01' AND '2011-12-16'."' in /opt/lib/weblib/DB.php:300
Stack trace:
#0 /opt/lib/weblib/DB.php(496): DB->query('SELECT value, T...')
#1 /home/marco/code/beluga/lib/TimeseriesHelper.php(100): DB->getAllAssoc('SELECT value, T...')
#2 /home/marco/code/beluga/lib/Song/ActivityReport.php(23): TimeseriesHelper::getDailyTimeSeries('SongTimeSeries_...', 'SongID', 32112155, '2011-07-01', '2011-12-16')
#3 [internal function]: Song_ActivityReport::getDailyStreams(32112155, '2011-07-01', '2011-12-16')
#4 /home/marco/code/beluga/lib/RPCizzle.php(43): call_user_func_array('Song_ActivityRe...', Array)
*** proof-of-concept.c
/*
* Linux vmsplice Local Root Exploit
* By qaaz
*
* Linux 2.6.17 - 2.6.24.1
*/
#define _GNU_SOURCE
#include <stdio.h>
@MarcoPolo
MarcoPolo / gist:1991000
Created March 7, 2012 04:53
caesar sallad
#include <iostream>
#include <string>
#include <limits>
int INPUT_MESSAGE = 1;
int ENCRYPT = 2;
int DECRYPT = 3;
int ANALYZE = 4;
@MarcoPolo
MarcoPolo / gist:1991001
Created March 7, 2012 04:53
caesar sallad
#include <iostream>
#include <string>
#include <limits>
int INPUT_MESSAGE = 1;
int ENCRYPT = 2;
int DECRYPT = 3;
int ANALYZE = 4;
@MarcoPolo
MarcoPolo / 41mux.vhd
Created March 19, 2012 16:05
4to1mux - 4bits wide
-- file = "mux45.vhd" , VHDL Representation of 4:1 Mux
-- note: these two dashes are used to creat a comment line in VHDL
-- VHDL is very syntax specific; Pay close attention to the details below.
library ieee; -- Specific VHDL library we will use that has definitions
-- of the variable types shown in the PORT statement below.
-- This library also supports the functions (and, OR & not)
-- we will use in the ARCHITECTURE section.
use ieee.std_logic_1164.all; -- The package that containing several libraries (including ieee).
-- This is like an include statement in 'C'.
@MarcoPolo
MarcoPolo / dabblet.css
Created June 4, 2012 18:02
Move in a circle without wrapper elements
/**
* Move in a circle without wrapper elements
* Idea by Aryeh Gregor, simplified by Lea Verou
*/
@keyframes rot {
from{
transform: translate3d(450px,0,0);
}
@MarcoPolo
MarcoPolo / dabblet.css
Created June 4, 2012 18:50 — forked from LeaVerou/dabblet.css
Move in a circle without wrapper elements
/**
* Move in a circle without wrapper elements
* Idea by Aryeh Gregor, simplified by Lea Verou
*/
@keyframes rot {
from {
transform: rotate(0deg)
translate(-150px)
rotate(0deg);