This file contains 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
#!/bin/sh | |
# psmem.sh | |
# http://abdussamad.com/archives/488-Memory-usage-of-a-process-under-Linux.html | |
ps -C $1 -O rss | gawk '{ count ++; sum += $2 }; END {count --; print "Number of processes =",count; print "Memory usage per process =",sum/1024/count, "MB"; print "Total memory usage =", sum/1024, "MB" ;};' |
This file contains 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
// my_list is an array of objects updated by ajax | |
var my_list = [{'id':1, 'name':'Jack'},{'id':2, 'name':'Robin'}]; | |
// with lodash | |
var add_new_messages = function(data) { | |
var new_list = my_list; | |
new_list.push.apply(new_list, data); | |
new_list = _.uniq(new_list, 'id'); |
This file contains 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
# Sets CORS headers for request from example1.com and example2.com pages | |
# for both SSL and non-SSL | |
SetEnvIf Origin "^https?://[^/]*(example1|example2)\.com$" ORIGIN=$0 | |
Header set Access-Control-Allow-Origin %{ORIGIN}e env=ORIGIN | |
Header set Access-Control-Allow-Credentials "true" env=ORIGIN | |
# Always set Vary: Origin when it's possible you may send CORS headers | |
Header merge Vary Origin |
This file contains 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
mail('mail@serversforhackers.com', 'Feedback', 'This is so useful, thanks!'); | |
Mail::send('emails.test', ['key' => 'value'], function($message) | |
{ | |
$message->to('foo@example.com', 'John Smith')->subject('Welcome!'); | |
}); |
NewerOlder