Skip to content

Instantly share code, notes, and snippets.

View sayanriju's full-sized avatar

Sayan "Riju" Chakrabarti sayanriju

View GitHub Profile
@sayanriju
sayanriju / keypress.py
Created February 7, 2019 12:01
A tiny, nifty script for playing random musical notes on each keypress
#!/usr/bin/env python
## A tiny, nifty script for playing random musical notes on each keypress.
##
## Copyright Sayan "Riju" Chakrabarti <[email protected]> 2009-2019
## Released under WTFPL Version 2
## (DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE)
## Copy of license text can be found online at
## http://sam.zoy.org/wtfpl/COPYING
##
## External/System Dependencies:
@sayanriju
sayanriju / Minimal_VirtualHost_Config.md
Last active March 17, 2023 13:24
Web Server Configs

Minimal VirtualHost Config

Nginx

server {
       listen 80;
       listen [::]:80;

       server_name example.com www.example.com;
@gdamjan
gdamjan / chrome-headless.service
Created September 13, 2017 18:28
headless chrome systemd service file
[Unit]
Description=headless chrome
[Service]
Type=simple
ProtectSystem=strict
DynamicUser=true
Environment=HOME=/tmp
ExecStart=/usr/bin/google-chrome --headless --disable-gpu --remote-debugging-port=9222

Why I hate TypeScript

Warning: These views are highly oppinated and might have some slightly incorrect facts. My experience with typescript was about 2 weeks in Node and a week in angular2.

Not Standard

TypeScript is implementing their own take on JavaScript. Some of the things they are writing will likely never make it in an official ES* spec either.

Technologies that have competing spec / community driven development have a history of failing; take: Flash, SilverLight, CoffeeScript, the list goes on. If you have a large code base, picking TypeScript is something your going to be living with for a long time. I can take a bet in 3 years JavaScript will still be around without a doubt.

Its also worth noting that they have built some things like module system and as soon as the spec came out they ditched it and started using that. Have fun updating!

@ccurtin
ccurtin / Custom Social Sharing Buttons for Wordpress Shortcode.php
Last active May 8, 2023 19:31
Custom Social Sharing Buttons for Wordpress
<?php
/*
http://stackoverflow.com/questions/12448134/social-share-links-with-custom-icons
http://petragregorova.com/articles/social-share-buttons-with-custom-icons
wp_enqueue_style('fontAwesome', '//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css', array(), '4.3.0', 'all');
use in template files:: <?php echo do_shortcode('[social_sharing]') ; ?>
*/
@RobK
RobK / serial.js
Last active June 28, 2022 02:54
Generate Random Serial Keys
/**
* Created by Robert Kehoe on 09/06/2014.
* MIT Licensed.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
@thoop
thoop / .htaccess
Last active November 13, 2024 20:20
Official prerender.io .htaccess for Apache.
# Change YOUR_TOKEN to your prerender token
# Change http://example.com (at the end of the last RewriteRule) to your website url
<IfModule mod_headers.c>
RequestHeader set X-Prerender-Token "YOUR_TOKEN"
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
@derekpeterson
derekpeterson / gist:5358722
Last active September 19, 2020 11:43
A little print-ready resume template in HTML and CSS
<!DOCTYPE html>
<head>
<title>Name</title>
<style type="text/css">
html {
background: white;
color: black;
font: 14px 'Helvetica Neue', Arial, sans-serif;
@gerbenvandijk
gerbenvandijk / Mark parent navigation active when on custom post type single page
Last active July 16, 2024 16:53
Mark (highlight) custom post type parent as active item in Wordpress Navigation.When you visit a custom post type's single page, the parent menu item (the post type archive) isn't marked as active. This code solves it by comparing the slug of the current post type with the navigation items, and adds a class accordingly.
<?php
function add_current_nav_class($classes, $item) {
// Getting the current post details
global $post;
// Get post ID, if nothing found set to NULL
$id = ( isset( $post->ID ) ? get_the_ID() : NULL );
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter