Skip to content

Instantly share code, notes, and snippets.

View dru's full-sized avatar

Andrii Melnyk dru

  • Unteleported.com
  • Kyiv, Ukraine
View GitHub Profile
@munrocket
munrocket / wgsl_3d_sdf.md
Last active July 13, 2024 05:11
WGSL 3D SDF Primitives

WGSL 3D SDF Primitives

Revision: 06.08.2023, https://compute.toys/view/407

Sphere - exact

fn sdSphere(p: vec3f, r: f32) -> f32 {
  return length(p) - r;
}
@jerodsanto
jerodsanto / wire-for-podcasters.md
Created December 18, 2017 15:34
Wire for Podcasters

Wire for Podcasters

Why

Most podcasters (ourselves included) begrudgingly use Skype to record our shows for two reasons:

  1. Most reliable call quality/lacency
  2. Network effect (guests usually have an account already)
@ashleymills
ashleymills / UIApplication+AppVersion
Created June 18, 2015 13:24
UIApplication category to get app version / build
@implementation UIApplication (AppVersion)
+ (NSString *) appVersion
{
return [[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFBundleShortVersionString"];
}
+ (NSString *) build
{
return [[NSBundle mainBundle] objectForInfoDictionaryKey: (NSString *)kCFBundleVersionKey];
@ashleymills
ashleymills / UIApplication+AppVersion.swift
Last active April 27, 2022 14:49
UIApplication extension to get app version / build
extension UIApplication {
class func appVersion() -> String {
return Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String
}
class func appBuild() -> String {
return Bundle.main.object(forInfoDictionaryKey: kCFBundleVersionKey as String) as! String
}
@jalberto
jalberto / remote_cache_with_project_root_strategy.rb
Created May 6, 2014 14:17
Capistrano 3.1.x Strategy to deploy git projects with subdirectories
# Usage:
# 1. Drop this file into lib/capistrano/remote_cache_with_project_root_strategy.rb
# 2. Add the following to your Capfile:
# require 'capistrano/git'
# require './lib/capistrano/remote_cache_with_project_root_strategy'
# 3. Add the following to your config/deploy.rb
# set :git_strategy, RemoteCacheWithProjectRootStrategy
# set :project_root, 'subdir/path'
# Define a new SCM strategy, so we can deploy only a subdirectory of our repo.
@willurd
willurd / web-servers.md
Last active July 22, 2024 15:25
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@dru
dru / gist:3818329
Created October 2, 2012 11:30
Install ruby 1.8.7 on Mac OS X Mountain Lion using RVM
Install ruby 1.8.7 on Mac OS X 10.8 (Mountain Lion) using RVM and MacPorts
1) Install http://xquartz.macosforge.org
2) sudo port install apple-gcc42
3) CC=/opt/local/bin/gcc-apple-4.2 CPPFLAGS=-I/opt/X11/include rvm install 1.8.7

These instructions work for the Raspberry Pi running Raspbian (hard float) and create a hardware optimized version of NodeJS for the Raspberry PI, (and include a working install and NPM!!!):

  1. Install Raspbian - http://www.raspberrypi.org/downloads

  2. Install the necessary dependecies:

sudo apt-get install git-core build-essential

(If you just installed git then you need to administer your git identity first, else adding the patches below will fail!!!)

@norman
norman / character_reference.rb
Last active September 9, 2021 20:48
HTML entities? We don't need no stinkin' HTML entities.
# coding: utf-8
#
# Encode any codepoint outside the ASCII printable range to an HTML character
# reference (https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Character_reference_overview).
def encode(string)
string.each_codepoint.inject("") do |buffer, cp|
cp = "&#x#{cp.to_s(16)};" unless cp >= 0x20 && cp <= 0x7E
buffer << cp
end
end
@evanwalsh
evanwalsh / gist:2552100
Created April 29, 2012 17:26 — forked from joelmoss/gist:2470666
Capistrano recipe for Puma start/stop/restarts
set :shared_children, shared_children << 'tmp/sockets'
namespace :deploy do
desc "Start the application"
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && RAILS_ENV=#{stage} bundle exec puma -b 'unix://#{shared_path}/sockets/puma.sock' -S #{shared_path}/sockets/puma.state --control 'unix://#{shared_path}/sockets/pumactl.sock' >> #{shared_path}/log/puma-#{stage}.log 2>&1 &", :pty => false
end
desc "Stop the application"
task :stop, :roles => :app, :except => { :no_release => true } do