Skip to content

Instantly share code, notes, and snippets.

View surfer190's full-sized avatar
🌆

surfer190 surfer190

🌆
  • South Africa
View GitHub Profile
@mvasilenko
mvasilenko / gist:b8c47616fa74de63dcc030508c53e7c1
Last active December 30, 2022 08:51
goaccess nginx apm log format template
time-format %T
date-format %d/%b/%Y
log_format "%d:%t +%^" client=%h method=%m request="%r" request_length=%^ status=%s bytes_sent=%b body_bytes_sent=%^ referer=%R user_agent="%^" upstream_addr=%^ upstream_status=%^ request_time=%T upstream_response_time=%^ upstream_connect_time=%^ upstream_header_time=%^
@grantland
grantland / post.md
Last active February 9, 2023 05:09
RecyclerView item onClick

RecyclerView item onClick

RecyclerView does not have an OnItemClickListener like it's predecessor, ListView. However, detecting item clicks is pretty simple.

Set an OnClickListener in your ViewHolder creation:

private class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder>  {

    public static class ViewHolder extends RecyclerView.ViewHolder
@surfer190
surfer190 / top-tracks.md
Last active March 5, 2023 12:54
Top tracks

Rock

  • ACDC - Hells Bells
  • Aerosmith - Dream On
  • Lynard Skynard - Simple Man
  • Bon Jovi - Wanted Dead Or Alive
  • Gerry Rafferty - Baker Street
  • Bob Seger - Turn the Page
  • Bob Seger - Main Street
  • Foreigner - Urgent
@codysoyland
codysoyland / virtualenv-auto-activate.sh
Created March 25, 2012 18:34
virtualenv-auto-activate
#!/bin/bash
# virtualenv-auto-activate.sh
#
# Installation:
# Add this line to your .bashrc or .bash-profile:
#
# source /path/to/virtualenv-auto-activate.sh
#
# Go to your project folder, run "virtualenv .venv", so your project folder
# has a .venv folder at the top level, next to your version control directory.
@tegansnyder
tegansnyder / hhvm_magento_setup.md
Last active July 14, 2023 22:30
HHVM Magento Server Setup

I've had the opertunity to try a variety of different server configurations but never really got around to trying HHVM with Magento until recently. I thought I would share a detailed walkthrough of configuring a single instance Magento server running Nginx + Fast CGI + HHVM / PHP-FPM + Redis + Percona. For the purpose of this blog post I'm assuming you are using Fedora, CentOS, or in my case RHEL 6.5.

Please note: I'm 100% open to suggestions. If you see something I did that needs to be done a different way, please let me know. I haven't included my Perconca my.conf file yet. I will shortly. Also I plan on trying this same test with HHVM 3.3 and PHP 7.

Install the EPEL, Webtatic, and REMI repos

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
@Nagyman
Nagyman / workflows-in-django.md
Last active January 27, 2024 08:29
Workflows in Django

Workflows (States) in Django

I'm going to cover a simple, but effective, utility for managing state and transitions (aka workflow). We often need to store the state (status) of a model and it should only be in one state at a time.

Common Software Uses

  • Publishing (Draft->Approved->Published->Expired->Deleted)
@naushad-rahman
naushad-rahman / using_requests_with_django.py
Created January 19, 2018 09:42 — forked from hbradio/using_requests_with_django.py
An example of using Python requests to log in and post data to your Django API
import requests
LOGIN_URL = "http://mydjangosite.com/accounts/login/"
ENDPOINT_URL = 'http://mydjangosite.com/myendpoint/'
'''
Create a session.
A session will automatically store the cookies that Django
sends back to you, like the csrf token and a the session id. You
could do it without the session, but then you'd have to save off the

Screencapture and animated gifs

I say "animated gif" but in reality I think it's irresponsible to be serving "real" GIF files to people now. You should be serving gfy's, gifv's, webm, mp4s, whatever. They're a fraction of the filesize making it easier for you to deliver high fidelity, full color animation very quickly, especially on bad mobile connections. (But I suppose if you're just doing this for small audiences (like bug reporting), then LICEcap is a good solution).

Capturing (Easy)

  1. Launch quicktime player
  2. do Screen recording

screen shot 2014-10-22 at 11 16 23 am

@arosenhagen
arosenhagen / magento-code-snippets.md
Last active April 8, 2024 09:21
[magento] - code snippets

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name