Skip to content

Instantly share code, notes, and snippets.

View dzlobin's full-sized avatar

Danny Zlobinsky dzlobin

View GitHub Profile
@clementgenzmer
clementgenzmer / FBAnimationPerformanceTracker.h
Last active September 18, 2023 23:02
FBAnimationPerformanceTracker
/*
* This is an example provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
@chrismdp
chrismdp / s3.sh
Last active March 5, 2024 12:57
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active April 20, 2024 16:52
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@codecaffeine
codecaffeine / randimg.rb
Last active February 21, 2024 22:22
Random Image Generator (imagemagick + ruby)
#!/usr/bin/env ruby
# Script to generate random images. Based on http://www.imagemagick.org/Usage/canvas/#random_blur
require 'optparse'
options = {}
optparse = OptionParser.new do |opts|
#!/bin/sh
# Pre-commit hook for git which removes trailing whitespace, converts tabs to spaces, and enforces a max line length.
if git-rev-parse --verify HEAD >/dev/null 2>&1 ; then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
@lanephillips
lanephillips / CGRectAspectFit.m
Created October 7, 2013 21:05
Objective-C code to fit a CGRect inside or outside another CGRect while maintaining aspect ratio. The fitted rectangle is centered on the target rectangle.
CGFloat ScaleToAspectFitRectInRect(CGRect rfit, CGRect rtarget)
{
// first try to match width
CGFloat s = CGRectGetWidth(rtarget) / CGRectGetWidth(rfit);
// if we scale the height to make the widths equal, does it still fit?
if (CGRectGetHeight(rfit) * s <= CGRectGetHeight(rtarget)) {
return s;
}
// no, match height instead
return CGRectGetHeight(rtarget) / CGRectGetHeight(rfit);
@SlexAxton
SlexAxton / .zshrc
Last active April 25, 2023 03:57
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@jclem
jclem / gifify.sh
Last active December 11, 2015 16:19
Shell script for turning .mov files into .gifs and posting to Cloudapp
#!/bin/bash
function printHelpAndExit {
echo 'Usage:'
echo ' gifify -coux filename'
echo ''
echo 'Options: (all optional)'
echo ' c CROP: The x and y crops, from the top left of the image, i.e. 640:480'
echo ' o OUTPUT: The basename of the file to be output (default "output")'
echo ' u: Upload the resulting image to CloudApp'
@andrewsardone
andrewsardone / gist:3889904
Last active January 31, 2020 17:07
A quick cheat sheet for using CocoaPods

CocoaPods project setup

Create a Podfile at the root of your project

platform :ios, '5.0'

pod 'AFNetworking'
pod 'OHAttributedLabel'
@oogali
oogali / wootbot.rb
Created August 18, 2011 18:48
Woot! IRC bot
#!/usr/bin/env ruby
require 'rubygems'
require 'isaac'
require 'net/http'
require 'nokogiri'
require 'open-uri'
CACHE_EXPIRATION = 3600
cache = {}