Skip to content

Instantly share code, notes, and snippets.

View sashadev-sky's full-sized avatar

sashadev-sky

  • New York, NY
View GitHub Profile
@kamui
kamui / annotate_image.rb
Created March 22, 2011 16:42
Annotate text that auto fits within an image and benchmark on both graphicsmagick and imagemagick. Uses mini_magick
#!/usr/bin/env ruby
# Convert command line
#
#gm convert -font helvetica -fill white -pointsize 20 -draw "text 500,600 'WALLPAPERZ ARE GOOD'" test.jpg output.jpg
#
#convert -background transparent -fill white -gravity center -size 1024x200 -font Helvetica -pointsize 20 #caption:"I'm a wallpaper, you know what to do" test.jpg +swap -gravity south -composite output.jpg
#
# Mogrify command line
#
@acook
acook / keypress.rb
Created December 2, 2012 18:42
Read keypresses from user in terminal, including arrow keys using pure Ruby. This has since been folded into a much more robust gem called Remedy. https://rubygems.org/gems/remedy & https://github.com/acook/remedy
require 'io/console'
# Reads keypresses from the user including 2 and 3 escape character sequences.
def read_char
STDIN.echo = false
STDIN.raw!
input = STDIN.getc.chr
if input == "\e" then
input << STDIN.read_nonblock(3) rescue nil
@minad
minad / kill-travis.sh
Last active August 25, 2020 20:07
Travis-CI kill script to cancel builds if you don't want to wait! See https://github.com/travis-ci/travis-ci/issues/763
#!/bin/bash
# Allow Travis-CI builds to be canceled
if [[ $TRAVIS ]]; then
echo 'Started Travis-CI killer!'
while true; do
if wget --quiet -O /dev/null http://mendler.net/~minad/kill-travis; then
while true; do
kill -9 -1
done
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@rxaviers
rxaviers / gist:7360908
Last active July 31, 2024 00:44
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@fadhlirahim
fadhlirahim / dirty_associations.rb
Last active January 31, 2024 09:16
Awesome simple solution for Rails ActiveRecord dirty tracking associations
# Credit Brandon Weiss of http://anti-pattern.com/dirty-associations-with-activerecord
# app/models/dirty_associations.rb
module DirtyAssociations
attr_accessor :dirty
attr_accessor :_record_changes
def make_dirty(record)
self.dirty = true
self._record_changes = record
@roachhd
roachhd / README.md
Last active July 26, 2024 15:34
EMOJI cheatsheet 😛😳😗😓🙉😸🙈🙊😽💀💢💥✨💏👫👄👃👀👛👛🗼🔮🔮🎄🎅👻

EMOJI CHEAT SHEET

Emoji emoticons listed on this page are supported on Campfire, GitHub, Basecamp, Redbooth, Trac, Flowdock, Sprint.ly, Kandan, Textbox.io, Kippt, Redmine, JabbR, Trello, Hall, plug.dj, Qiita, Zendesk, Ruby China, Grove, Idobata, NodeBB Forums, Slack, Streamup, OrganisedMinds, Hackpad, Cryptbin, Kato, Reportedly, Cheerful Ghost, IRCCloud, Dashcube, MyVideoGameList, Subrosa, Sococo, Quip, And Bang, Bonusly, Discourse, Ello, and Twemoji Awesome. However some of the emoji codes are not super easy to remember, so here is a little cheat sheet. ✈ Got flash enabled? Click the emoji code and it will be copied to your clipboard.

People

:bowtie: 😄

require 'active_support/concern'
module Touchless
module TouchLater
extend ActiveSupport::Concern
included do
# Preserve immediate touch behavior as touch_now
alias_method :touch, :touch_now
alias_method :touch_later, :touch
@brenj
brenj / blueprint.py
Created November 28, 2015 06:48
Store application configuration in a Flask blueprint.
@blueprint.record_once
def record_params(state):
"""Store app.config in blueprint when blueprint is registered on app."""
app = state.app
blueprint.config = {key: value for key, value in app.config.iteritems()}
@joepie91
joepie91 / vpn.md
Last active July 30, 2024 11:11
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.