Skip to content

Instantly share code, notes, and snippets.

View pabloroman's full-sized avatar

Pablo Román pabloroman

View GitHub Profile

Ticket 1111

We'd like to add a page to view user profiles. Users can view only their own profiles but an admin can see anyone's profile.

A user can also update their profile, they are allowed to change their display name and phone number. Afterwards their updated profile should be shown.

For compliance reasons, we need to log when a user views their own profile. We don't want to log views by admins.

Just for clarity's sake, it would be nice if we could highlight on the page if the user is an admin.

@pabloroman
pabloroman / gist:7308541
Created November 4, 2013 20:14
Disqus callback
public function action_disqus() {
$input = Input::all();
if ( isset( $input['error'] ) ) {
die( $input['error'] );
}
if( isset( $input['verify'] ) ) {
$code = $input['code']; // A temporary token which you will exchange for a finalized access token.
@pabloroman
pabloroman / gist:6068508
Last active December 20, 2015 04:09
Cronjobs para politweets.es
* * * * * php /var/www/politweets.es/private/stream/process_stream.php >> /dev/null 2>&1
*/5 * * * * php /var/www/politweets.es/private/stream/monitor_stream.php >> /dev/null 2>&1
50 * * * * php /var/www/politweets.es/private/scripts/beanstalk/stats_updater.fill.php >> /dev/null 2>&1
* * * * * php /var/www/politweets.es/private/scripts/beanstalk/stats_updater.process.php >> /dev/null 2>&1
15 * * * * find /var/www/dev.politweets.es/private/cache/es/sql -mmin +720 -delete
15 * * * * find /var/www/politweets.es/private/cache/es/sql -mmin +720 -delete
20 * * * * find /var/www/dev.politweets.es/private/cache/es/html -mmin +720 -delete
20 * * * * find /var/www/politweets.es/private/cache/es/html -mmin +720 -delete
@pabloroman
pabloroman / gist:5611769
Created May 20, 2013 11:42
Varnishtop -i TxURL
1.49 TxURL /wp-admin/post.php?post=621963&action=edit&message=10
1.48 TxURL /?p=621963&preview=true
1.13 TxURL /?s=%22datadog%22
1.09 TxURL /2009/01/08/how-to-snap-up-that-twitter-username-youve-always-wanted/
1.00 TxURL /wp-content/blogs.dir/1/files/2012/02/Screen-Shot-2012-02-02-at-9.57.39-AM-594x245.png
1.00 TxURL /wp-content/blogs.dir/1/files/2012/08/youtube-520x245@2x.jpg
1.00 TxURL /apps/2011/09/07/the-5-best-blogging-platforms-you-havent-heard-of/
1.00 TxURL /wp-content/blogs.dir/1/files/2013/05/2013-05-19_10h02_57-520x245@2x.jpg
1.00 TxURL /wp-content/blogs.dir/1/files/2011/12/Altodot-The-Fan-Machine-founders-657x245.jpg
1.00 TxURL /wp-content/blogs.dir/1/files/2011/12/Anton-Chalbaud-300x200.jpg
@pabloroman
pabloroman / gist:5611763
Created May 20, 2013 11:40
Varnishtop -i RxURL
96.41 RxURL /wp-content/themes/icetea/assets/stylesheets/styles.css?1366631169
88.53 RxURL /wp-content/themes/icetea/assets/js/tnw.js?1368742061
84.88 RxURL /wp-content/themes/icetea/assets/js/libraries.js?1355331683
75.07 RxURL /wp-content/themes/icetea/assets/images/sprite.20121122.svg
73.08 RxURL /wp-content/themes/icetea/assets/images/tnw-loading-grey.gif
68.45 RxURL /wp-content/themes/icetea/assets/images/spinner.gif
68.26 RxURL /wp-content/themes/icetea/assets/fonts/0dc68bf6-6370-4b81-9d14-f4a3e4945a25-3.woff
67.91 RxURL /wp-content/themes/icetea/assets/fonts/fa446211-272d-435f-84e5-0b72a78d3e68-3.woff
66.48 RxURL /wp-content/themes/icetea/assets/fonts/13e28e74-142d-4dc5-a420-4f51798f8c70-3.woff
66.47 RxURL /favicon.ico
@pabloroman
pabloroman / varnishstat.txt
Created May 20, 2013 11:19
Varnishstat for TNW
39+19:50:15
Hitrate ratio: 10 100 141
Hitrate avg: 0.9519 0.9288 0.9272
140302542 46.93 40.77 client_conn - Client connections accepted
641 0.00 0.00 client_drop - Connection dropped, no sess/wrk
253372226 60.91 73.63 client_req - Client requests received
321234903 86.88 93.35 cache_hit - Cache hits
280754 0.00 0.08 cache_hitpass - Cache hits for pass
23226341 2.00 6.75 cache_miss - Cache misses
var Post = Backbone.Model.extend({
idAttribute: "post_id",
});
<script type="text/javascript">
/* <![CDATA[ */
var disqus_url = 'http://pablo.thenextweb.com/mobile/2012/09/06/hands-on-nokias-new-lumia-920-photos/';
var disqus_identifier = '442335 http://pablo.thenextweb.com/?p=442335';
var disqus_container_id = 'disqus_thread';
var disqus_domain = 'disqus.com';
var disqus_shortname = 'beta-thenextweb';
var disqus_title = "Hands-on with Nokia&#8217;s new Lumia 920 [Photos]";
var disqus_config = function () {
var config = this; // Access to the config object
$(document).ready(function () {
function n() {
m = document.body.scrollTop || document.documentElement.scrollTop || window.pageYOffset || 0;
if (m < 0) {
m = 0
}
d.css({
"margin-top": -(m / 3) + "px",
opacity: 1 - m / 350
});
@pabloroman
pabloroman / gist:2225579
Created March 28, 2012 11:45
TNW init_livefyre
init_livefyre: function() {
TNW.lf_custom_delegate = {
handle_auth_login: function(data) {
//if(typeof(LF.data.user) != 'undefined') {
on_login_open('login', 'refresh_livefyre');
//}
//return false;
},
handle_auth_logout: function(data) {