Skip to content

Instantly share code, notes, and snippets.

@adamsir
adamsir / brainfuck.c
Created November 6, 2023 12:03
Brainfuck interpreter in C
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#define TAPE_SIZE 30000
// Declare an array to act as the tape for Brainfuck. Initialize all to zero.
unsigned char s[TAPE_SIZE] = {0};
// This will be the data pointer used in Brainfuck
@adamsir
adamsir / git-checkout-interactive.plugin.zsh
Created November 1, 2023 10:20
Git interactive checkout
#######################################
# git checkout interactive #
#######################################
function git-checkout-interactive() {
# Get all branches sorted by committer date, along with their last commit hash
local branches
branches=$(git for-each-ref --sort=-committerdate --format='%(refname:short) %(objectname:short)' refs/heads/)
# Parse branches
@adamsir
adamsir / input.scss
Created October 25, 2020 01:11
Generated by SassMeister.com.
// principles/sizes
$magic: 2;
$base: 16;
@function s($value) {
@return $value / $base + 0rem
}
@function set-color($color) {
@if (lightness( $color ) > 40) {
@adamsir
adamsir / index.html
Created August 24, 2018 14:52
Electron Fiddle Gist
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
We are using Node.js <script>document.write(process.versions.node)</script>,
@adamsir
adamsir / index.html
Created August 24, 2018 14:48
Electron Fiddle Gist
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
We are using Node.js <script>document.write(process.versions.node)</script>,
@adamsir
adamsir / SassMeister-input.scss
Last active September 30, 2015 09:02
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
// Table of Contents
// 1. Color Generator by @pankajparashar
// 2. Content Level generator by @donuteeze
// ==========================================================================
@adamsir
adamsir / SassMeister-input.scss
Created September 21, 2015 14:30
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
/* _settings.scss */
$blue: blue;
$black: black;
/* původní komponenta */
@mixin unread-mark($background) {
@adamsir
adamsir / SassMeister-input-HTML.html
Created September 21, 2015 14:04
Generated by SassMeister.com.
<div class="content-box"></div>
<div class="profile">
<div class="content-box"></div>
</div>
@adamsir
adamsir / Event Listener IE6+ Polyfill
Created July 9, 2015 11:52
addEventListener && removeEventListener polyfill IE6+
/**
* @license addEventListener polyfill 1.0 / Eirik Backer / MIT Licence
* https://gist.github.com/2864711/946225eb3822c203e8d6218095d888aac5e1748e
*/
(function (window, document, listeners_prop_name) {
if ((!window.addEventListener || !window.removeEventListener) && window.attachEvent && window.detachEvent) {
/**
* @param {*} value
* @return {boolean}
*/
@adamsir
adamsir / SassMeister-input.scss
Created April 27, 2015 10:35
Generated by SassMeister.com.
// ----
// libsass (v3.1.0)
// ----
// This is the default html and body font-size for the base rem value.
$rem-base: 16px;
@function strip-units($number) {
@return $number / ($number * 0 + 1);
}