Skip to content

Instantly share code, notes, and snippets.

View developeryamhi's full-sized avatar

Biraj Pandey developeryamhi

View GitHub Profile
@cstockton
cstockton / limitgroup.go
Last active November 30, 2018 12:27
Another example of sync.cond.
package xsync
import (
"fmt"
"sync"
"time"
)
type LimitGroup struct {
wg sync.WaitGroup
@developeryamhi
developeryamhi / connected_taxonomies
Last active August 29, 2015 14:16
Get the Connected Taxonomies in WordPress
// Get the Connected Taxonomies via Posts
function get_the_connected_taxonomies($tax_name, $rel_tax_type = 'post_tag', $tax_type = 'category', $post_type = 'post', $from_cache = true, $search_key = 'slug') {
// Transient Key
$transient_key = $post_type . '-' . $rel_tax_type . '-' . $tax_type . '-' . $tax_name . '-cache';
// Check
if($from_cache && get_transient($transient_key)) {
// Return
@anthonyholmes
anthonyholmes / bootstrap-sass-mixin-cheatsheet.scss
Created October 10, 2014 08:13
Bootstrap Sass Mixin Cheatsheet
// Alerts
@include alert-variant($background, $border, $text-color);
// Background Variant
@include bg-variant($parent, $color);
// Border Radius
@include border-top-radius($radius);
@include border-right-radius($radius);
@include border-bottom-radius($radius);
@SegFaultAX
SegFaultAX / gist:10507478
Last active August 22, 2021 02:40
Dotted path expansion for Python dictionary keys
import operator
from pprint import pprint
def is_dict(d):
return isinstance(d, dict)
def get(c, k, default=None):
try:
return c[k]
except (IndexError, KeyError, TypeError):
@dloman
dloman / xvfb
Last active September 12, 2023 12:32 — forked from jterrace/xvfb
### BEGIN INIT INFO
# Provides: Xvfb
# Required-Start: $local_fs $remote_fs
# Required-Stop:
# X-Start-Before:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Loads X Virtual Frame Buffer
### END INIT INFO
@schickling
schickling / Rakefile
Last active January 31, 2024 23:00
Activerecord without Rails
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)
@jterrace
jterrace / xvfb
Created June 11, 2012 18:46
xvfb init script for Ubuntu
XVFB=/usr/bin/Xvfb
XVFBARGS=":1 -screen 0 1024x768x24 -ac +extension GLX +render -noreset"
PIDFILE=/var/run/xvfb.pid
case "$1" in
start)
echo -n "Starting virtual X frame buffer: Xvfb"
start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS
echo "."
;;
stop)
@jrivero
jrivero / csv_splitter.py
Created July 15, 2011 20:33 — forked from palewire/csv_splitter.py
A Python CSV splitter
import os
def split(filehandler, delimiter=',', row_limit=10000,
output_name_template='output_%s.csv', output_path='.', keep_headers=True):
"""
Splits a CSV file into multiple pieces.
A quick bastardization of the Python CSV library.
Arguments:
@ihumanable
ihumanable / Excel.php
Last active February 6, 2024 06:24
Simple Excel Writer in PHP
<?php
/**
* Simple excel writer class with no external dependencies, drop it in and have fun
* @author Matt Nowack
* @link https://gist.github.com/ihumanable/929039/edit
* @license Unlicensed
* @version 1.0
*/
class Excel {