Skip to content

Instantly share code, notes, and snippets.

View snatchev's full-sized avatar
🎏
worse is better

Stefan Natchev snatchev

🎏
worse is better
View GitHub Profile
@snatchev
snatchev / .tmux.conf
Created July 16, 2020 14:11
Simple practical tmux conf
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
diff --git a/app/features-json/middleware/jwt_auth.rb b/app/features-json/middleware/jwt_auth.rb
index e6c1f15..9d0e1a1 100644
--- a/app/features-json/middleware/jwt_auth.rb
+++ b/app/features-json/middleware/jwt_auth.rb
@@ -5,14 +5,19 @@ require "jwt"
module FastlaneCI
# API Middleware responsible of authenticate all the requests that uses it.
class JwtAuth
- def initialize(app)
+ def initialize(app, encryption_key=nil)
@snatchev
snatchev / png.rb
Created January 12, 2018 18:58
a simple single-class PNG decoder in raw ruby with no external dependencies.
require 'zlib'
##
# This is a simple PNG decoder, inspired and adapted from ChunkyPNG
class PNG
SIGNATURE = [137, 80, 78, 71, 13, 10, 26, 10].pack('C8').force_encoding('BINARY')
attr_reader :width, :height, :depth, :color, :compression, :filtering, :interlace
##
@snatchev
snatchev / index.html
Created July 11, 2017 18:36
remote debugging
<html>
<head>
<script src="https://jsconsole.com/js/remote.js?snatchev"></script>
</head>
<body>
@snatchev
</body>
</html>
@snatchev
snatchev / gh.fish
Last active May 22, 2022 06:57
a fish-shell function to open the current git repo/branch in a browser
function gh --description 'Open the webpage for the current github repo/branch'
set -l fetch_url (command git remote --verbose show -n origin ^/dev/null | command grep Fetch | cut -c 14- )
#did we get an exit status?
if [ $status -gt 0 ]
echo 'Not a git repo.'
return 1
end
if [ -z $fetch_url ]
@snatchev
snatchev / AppDelegate.h
Last active August 29, 2015 14:13
register VoIP push notifications with ZeroPush: https://zeropush.com/guide/guide-to-pushkit-and-voip
#import <UIKit/UIKit.h>
#import <PushKit/PushKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate, PKPushRegistryDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
@snatchev
snatchev / zeropush.js
Last active August 29, 2015 14:13
cloudcode-zeropush.js
/* simple API wrapper for Parse Cloud Code and ZeroPush */
ZeroPush = {
authToken: 'your-server-auth-token',
verifyCredentials: function(){
this.request('GET', '/verify_credentials');
},
register: function(params){
this.request('POST', '/register', params);
},
#!/bin/bash
# Run this in the same location as your .xcodeproj file
plutil -convert json -r -o - `xcodebuild -showBuildSettings | grep PRODUCT_SETTINGS_PATH | awk -F ' = ' '{print $2}'` | grep CFBundleIdentifier | awk -F ' : ' '{print $2}' | cut -d'"' -f2
@snatchev
snatchev / ios7.css.scss
Created July 16, 2014 04:07
iphone in CSS with ZeroPush push notification
.ios7 {
-webkit-font-smoothing: antialiased;
font-family: 'HelveticaNeue-UltraLight', 'Helvetica Neue UltraLight', 'Helvetica Neue', Arial;
background: #3F505E;
padding-top: 20px;
font-weight: 300;
line-height: normal;
position: relative;
::selection {
@snatchev
snatchev / gist:9792858
Created March 26, 2014 20:38
Disable Java SOCKS Proxy in OS X
Java will use the system SOCKS proxy by default, but it will not bypass the hostnames such as *.local, localhost, 0.0.0.0, etc.
The Java PrefPane also does not disable the SOCKS proxy even if you choose "Direct Connection". The best way to disable JAVA from connecting over a Proxy is to set the options with no values:
JAVA_OPTS="$JAVA_OPTS -DsocksProxyPort -DsocksProxyHost"
thanks to: http://mxw.pl/blog/?p=4