Skip to content

Instantly share code, notes, and snippets.

View SinghCoder's full-sized avatar
🎯
Focusing

Harpinder SinghCoder

🎯
Focusing
View GitHub Profile
@Birch-san
Birch-san / make_portable.sh
Last active October 2, 2025 10:28
Make a macOS executable binary or .dylib portable
#!/usr/bin/env bash
# Licensed by author Alex Birch under CC BY-SA 4.0
# https://creativecommons.org/licenses/by-sa/4.0/
# Example input:
# ./make_portable.sh mycoolbinary
# where mycoolbinary is a mach-o object file
# (for example an executable binary or a .dylib)
#
@escgeek
escgeek / Lightning Printable View Page
Created February 13, 2018 20:45
Easy solution to create a printable record page in Salesforce Lightning (Spring 18)
<apex:page standardController="Complaint__c" sidebar="false" title="{!Complaint__c.Name}" showHeader="false">
<apex:form >
<br/>&nbsp;&nbsp;&nbsp;
<!--<br/><u><a href="/{!Complaint__c.Id}">Return to {!Complaint__c.Name}</a></u>&nbsp;-&nbsp;
<apex:commandLink value="Click for Printable View" onclick="window.print();"/> -->
<apex:commandbutton value="<-- Click to Return to {!Complaint__c.Name}" action="/{!Complaint__c.Id}" />&nbsp;&nbsp;&nbsp;
<apex:commandButton onclick="window.print();" value="Print Compliant" />
<apex:detail subject="{!Complaint__c.Id}" relatedList="false" title="false"/>
</apex:form>
</apex:page>
@leonidessaguisagjr
leonidessaguisagjr / py-git-cat-file.py
Last active July 30, 2023 06:46
Studying git internals: implement `git cat-file` in Python
#!/usr/bin/env python3
"""Implementation of git cat-file in Python.
This Gist is published under the MIT License:
MIT License
Copyright (c) 2019 Leonides T. Saguisag, Jr.
Permission is hereby granted, free of charge, to any person obtaining a copy
@PurpleBooth
PurpleBooth / README-Template.md
Last active July 23, 2026 22:51
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@darryn
darryn / Shopify tag filter groups
Last active November 19, 2025 07:52
Create tag filter groups in Shopify. This snippet is designed to group and separate out collection tags. It requires the tags to share a common value prepended to the tag with an underscore. E.g. to create a separate tag filter group for 'brands', each product will need to be tagged with 'brand_Nike' or 'brand_Reebok'. Some of this is probably l…
{% if template contains 'collection' and collection.all_tags.size > 1 %}
<!-- A recursive loop to catch and filter out the different tag categories -->
{% assign c = 0 %}
{% for t in collection.all_tags %}
{% capture cat %}{{ cat }}{% capture temp_cat %}{% if t contains '_' %}{% assign cat_grp = t | split: '_' %}{{ cat_grp.first }}{% endif %}{% endcapture %}{% unless cat contains temp_cat %}{% if t contains '_' %}{% assign new_cat_grp = t | split: '_' %}{{ new_cat_grp.first }}{% endif %}{% unless forloop.last %}+{% endunless %}{% assign c = c | plus: 1 %}{% endunless %}{% endcapture %}
{% endfor %}
<!-- create array of tag categories -->
{% assign cat_array = cat | split: '+' %}
@jboner
jboner / latency.txt
Last active July 27, 2026 01:35
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@masak
masak / explanation.md
Last active July 13, 2026 21:32
How is git commit sha1 formed

(The below text is licensed with CC0, which means that if you want to use or translate it, that is OK by me.)

Ok, I geeked out, and this is probably more information than you need. But it completely answers the question. Sorry. ☺

Locally, I'm at this commit:

$ git show
commit d6cd1e2bd19e03a81132a23b2025920577f84e37
Author: jnthn <jnthn@jnthn.net>

Date: Sun Apr 15 16:35:03 2012 +0200