Skip to content

Instantly share code, notes, and snippets.

@zulhfreelancer
zulhfreelancer / heroku_pg_db_reset.md
Last active June 17, 2024 11:44
How to reset PG Database on Heroku (for Rails app)?

It's important to note that running this reset will drop any existing data you have in the application

How to reset PG Database on Heroku?

  • Step 1: heroku restart
  • Step 2: heroku pg:reset DATABASE (no need to change the DATABASE)
  • Step 3: heroku run rake db:migrate
  • Step 4: heroku run rake db:seed (if you have seed)

One liner

@lopspower
lopspower / README.md
Last active April 17, 2025 19:49
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

import React from "react";
import { render } from "react-dom";
const ParentComponent = React.createClass({
getDefaultProps: function() {
console.log("ParentComponent - getDefaultProps");
},
getInitialState: function() {
console.log("ParentComponent - getInitialState");
return { text: "" };
@mamantoha
mamantoha / experience.rb
Last active April 13, 2025 08:50
Rails API Filtering and Sorting
# app/models/experience.rb
#
# == Schema Information
#
# Table name: experiences
#
# id :integer not null, primary key
# title :string
# description :text
# created_at :datetime not null
@maxivak
maxivak / 00.md
Last active April 8, 2025 18:31
Sending emails with ActionMailer and Sidekiq

Sending emails with ActionMailer and Sidekiq

Send email asynchroniously using Sidekiq.

ActionMailer

Create your mailer us usual:

@waleedsamy
waleedsamy / README.md
Last active August 5, 2021 19:19 — forked from vitkin/README.md
compile wstunnel for apache 2.2.15 on centos CentOS release 6.6 (Final)

Backport WebSocket to Apache 2.2

This is my variation from the original patch and that also includes the suggested correction for the bug with secure websocket 'wss://'.

The difference is that I avoid modifying the mod_utils.c and the mod_proxy.h so that if the mod_proxy module has been embedded in the main httpd binary then it will work and you won't get the

@janizde
janizde / wpml-term-slug-fiter.php
Last active August 29, 2015 14:17
Filter fixing WPML appending language codes on term slugs
<?php
/**
* Filter fixing term slug for WPML plugin
* always (!) removes -{language code} (including repetitions like "-de-de-de") from the end of the slug before it is saved in the database and after WPML modified the slug.
* Note that this will always happen, even if you typed in the language code yourself in the input.
* The function will not strip combinations of different language codes like "-de-en-de" (this would certainly result in "-de-en").
*
* @author Jannik Portz (@janizde)
* @param string $slug The slug coming from WPML_Term_Translations::pre_term_slug_filter
* @return string The slug without language codes at the end
@vitorbritto
vitorbritto / add_apache_brew.md
Last active March 4, 2019 10:30
Install Apache with Homebrew

Install Apache with Homebrew

Installing Apache

# Start by stopping the built-in Apache, if it's running, and prevent it from starting on boot.
# This is one of very few times you'll need to use sudo:
sudo launchctl unload /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null

# We need to tap homebrew-dupes because "homebrew-apache/httpd22" relies on "homebrew-dupes/zlib"

and install Apache 2.2 with the event MPM, and we'll use Homebrew's OpenSSL library

@xbeta
xbeta / README.md
Last active March 27, 2025 01:16
Macbook Pro Bluetooth + WiFi 2.4GHz interference fix for Mavericks
@sergejmueller
sergejmueller / fastcgi_cache
Last active August 29, 2015 14:05
Nginx-Caching für PHP-generierte Inhalte. Weitere Details: http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html
## DEFAULT
set $no_cache 0;
## RULES
if ( $request_uri ~ "/wp-" ) {
set $no_cache 1;
}
if ( $http_cookie ~ (wp-postpass|wordpress_logged_in|comment_author)_ ) {
set $no_cache 1;