Skip to content

Instantly share code, notes, and snippets.

CREATE OR REPLACE FUNCTION from_unixtime(integer) RETURNS timestamp AS '
SELECT to_timestamp($1)::timestamp AS result
' LANGUAGE 'SQL';
/**
* Server Side
*/
var players = [];
var count = 0;
sails.io.on('connection', function (socket) {
var player = {};
socket.on('register', function (uuid) {
@m4tm4t
m4tm4t / gist:8470086
Last active January 3, 2016 13:29
Zend 2 crazy flash notices with namespaces
<?php
// Set message
$this->flashMessenger()
->setNamespace("success")
->addMessage("You've been logged out");
return $this->redirect()->toUrl('/');
// Retrieve message
$notice = null;
$flash = $this->flashMessenger();
$(window).on('keydown', function(event) {
if (event.ctrlKey && event.which != 17) {
if (event.which == 80) {
event.preventDefault();
alert('CTRL + P !');
}
}
})
@m4tm4t
m4tm4t / gist:7335782
Last active December 27, 2015 13:49
Better var_dump output
<?php
//=> https://github.com/foohey/bar_dump
/*
* CSS Editor
* Author: robard_m
*/
// Page load event
window.addEventListener('load', function load(event) {
window.removeEventListener('load', load, false);
CSSeditor.init();
});
@m4tm4t
m4tm4t / gist:7251843
Last active December 27, 2015 02:19
code found in a school project
function test(){
if((document.getElementById('pupupuce').style.height == '0px') && (document.getElementById('acceuilpuce').style.opacity == '0') && (document.getElementById('acceuilpuce1').style.opacity == '0') && (document.getElementById('acceuilpuce2').style.opacity == '0')){
document.getElementById('acceuilpuce').style.opacity = '1';
document.getElementById('acceuilpuce1').style.opacity = '1';
document.getElementById('acceuilpuce2').style.opacity = '1';
document.getElementById('acceuilpuce').style.transitionDuration = '1s';
document.getElementById('acceuilpuce1').style.transitionDuration = '1s';
document.getElementById('acceuilpuce2').style.transitionDuration = '1s';
document.getElementById('pupupuce').style.height = '85px';
document.getElementById('pupupuce').style.transitionDuration = '1s';
function download(links, id) {
setTimeout(function() {
link = $(links[id]).attr('href');
id = link.split("id=")[1];
window.location = '/torrents/download/?id=' + id;
}, 2000*id);
}
(function() {
links = $("a[href*='/nfo/']");
for (var i = links.length - 1; i >= 0; i--) {
[foohey@foo-arch ~]$ whois microsoft.com
Whois Server Version 2.0
Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.
Server Name: MICROSOFT.COM.ZZZZZZZZZZZZZZZZZZZZZZ.IS.A.GREAT.COMPANY.ITREBAL.COM
IP Address: 97.107.132.202
[foohey@foo-arch ~]$ whois google.com
Whois Server Version 2.0
Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.
Server Name: GOOGLE.COM.ZZZZZZZZZZZZZZZZZZZZZZZZZZ.HAVENDATA.COM
IP Address: 50.23.75.44