nmcli
: Control network manager from command line (seeman nmcli
)df -h
: Show disk space for humansscp file user@server:path/file
: Transfer file over SSHwhereis command
: Path to commandssh user@server
: Start SSH sessiom (exit withexit
)ls -lah dir
: Show content of directory for humans, including hidden filescd dir
: Change directorymkdir
: Create directory
This file contains hidden or 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 oTable = $("#whatever").dataTable({ | |
// ....options here | |
}); | |
// then we can do... | |
$(this).parents("TR").fadeOut("slow", function () { | |
var pos = oTable.fnGetPosition(this); | |
oTable.fnDeleteRow(pos); | |
}); |
This file contains hidden or 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
## The Problem | |
Standard practices say no non-root process gets to talk to the Internet on a port less than 1024. How, then, could I get Node talking on port 80 on EC2? (I wanted it to go as fast as possible and use the smallest possible share of my teeny tiny little micro-instance's resources, so proxying through nginx or Apache seemed suboptimal.) | |
## The temptingly easy but ultimately wrong solution: | |
Alter the port the script talks to from 8000 to 80: | |
}).listen(80); |
This file contains hidden or 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
# ...imports and other stuff.... | |
# This is really important when we set DEBUG = False on settings.py to define custom error pages.... | |
handler404 = 'my_app_name.views.not_found_404' | |
handler500 = 'my_app_name.views.internal_error_500' | |
# ...urlpatterns and another stuff.... |
This file contains hidden or 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
You just went to the Google home page. | |
Simple, isn't it? | |
What just actually happened? | |
Well, when you know a bit of about how browsers work, it's not quite that simple. You've just put into play HTTP, HTML, CSS, ECMAscript, and more. Those are actually such incredibly complex technologies that they'll make any engineer dizzy if they think about them too much, and such that no single company can deal with that entire complexity. | |
Let's simplify. |
This file contains hidden or 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
----- git rm -r --cached <folder_name> | |
It discard of git index but not from local working copy...useful when by accident we pushed something to remote repository and then we have to remove it from that repo. | |
----- git remote set-url <remote_name> <new_url_here> | |
It can set a new url for the current repository, useful when we change the name of the repository on Github for example, as Github also change the url for this. | |
This file contains hidden or 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
public function ImageCreateFromBMP($p_sFile) | |
{ $file = fopen($p_sFile,"rb"); | |
$read = fread($file,10); | |
while(!feof($file)&&($read<>"")) | |
$read .= fread($file,1024); | |
$temp = unpack("H*",$read); | |
$hex = $temp[1]; | |
$header = substr($hex,0,108); | |
if (substr($header,0,4)=="424d") | |
{ |
This file contains hidden or 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
$adapter = $this->tableGateway->getAdapter(); | |
$select = new Select(); | |
$select->from('alb_imagen') | |
->columns(array('itemId' => 'id_imagen', | |
'value' => 'titulo')) | |
->limit(12) | |
->join(array('t' => 'alb_thumbnail'),'t.id_imagen = alb_imagen.id_imagen',array('imagen' => 'nombre')) | |
->where('t.tipo = \'MINI_ICON50X50\' and alb_imagen.activo =1') | |
->where(array(new PredicateSet(array(new Like('titulo', "%".$query."%"), | |
new Like('descripcion', "%$query%") |
This file contains hidden or 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
$adapter = $this->tableGateway->getAdapter(); | |
$select = new Select(); | |
$select->from('tax_tags') | |
->limit(5) | |
->where->like('tag', "%".$query."%"); | |
$statement = $adapter->createStatement(); | |
$select->prepareStatement($adapter, $statement); | |
$result = $statement->execute(); |
This file contains hidden or 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
$compare = "31-10-1991"; | |
// first validate the format...it could be: 24-05-2013,24/05/2013,24.05.2013,24-5-2013,24.5.2013,24/5/2013...or something like that(at this point we've just validated the format...not the date) | |
if(preg_match('/^(3[0-1]|[0-2]?[0-9])[\/.-](1[0-2]|0?[0-9])[\/.-][0-9]{4}$/',$compare)){ | |
$date_parsed = preg_split('/[\/.-]/', $compare); | |
//if the format is correct we're going to see if the date is valid....for example: 31-02-2013 should be invalid.... | |
if(!checkdate($date_parsed[1],$date_parsed[0],$date_parsed[2])){ |
NewerOlder