Skip to content

Instantly share code, notes, and snippets.

View abdollar's full-sized avatar

Abdul Chaudhry abdollar

View GitHub Profile
@mallorypaine
mallorypaine / gist:8049184
Created December 20, 2013 01:38
IFTTAnimation accumulates errors in a subtle way. Every time you add an animation, the timeline gets one extra entry. Here's my fix. Note that the inner for-loop used to break when j <= nextKeyFrameTime. Suppose you have keyFrames at times 100, 200, and 300. With <= nextKeyFrameTime, you'll get two entries for time 100, 200, and 300, and you'll …
self.timeline = [NSMutableArray new];
for (NSUInteger i = 0; i < self.keyFrames.count - 1; i++) {
IFTTTAnimationKeyFrame *keyFrame = [self.keyFrames objectAtIndex:i];
IFTTTAnimationKeyFrame *nextKeyFrame = [self.keyFrames objectAtIndex:i+1];
NSInteger j;
for (j = keyFrame.time; j < nextKeyFrame.time; j++) {
[self.timeline addObject:[self frameForTime:j startKeyFrame:keyFrame endKeyFrame:nextKeyFrame]];
}
if (i + 1 == self.keyFrames.count - 1) {
@gmccreight
gmccreight / master.vim
Last active August 26, 2024 17:49
A script that gives you a playground for mastering vim
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
@devinfoley
devinfoley / locales_1.csv
Last active July 30, 2022 07:44
Dates in various locales on iOS
locale_id time formatted
en_IE 00:00 11 Jul 2013 00:00:00 Pacific Daylight Time
en_IE 00:01 11 Jul 2013 01:00:00 Pacific Daylight Time
en_IE 12:00 11 Jul 2013 12:00:00 Pacific Daylight Time
en_IE 12:01 11 Jul 2013 13:00:00 Pacific Daylight Time
ro_MD 00:00 11.07.2013, 00:00:00 Ora de vară în zona Pacific
ro_MD 00:01 11.07.2013, 01:00:00 Ora de vară în zona Pacific
ro_MD 12:00 11.07.2013, 12:00:00 Ora de vară în zona Pacific
ro_MD 12:01 11.07.2013, 13:00:00 Ora de vară în zona Pacific
br 00:00 2013 Goue 11 00:00:00 GMT-07:00
# you can make a text file of request times (in ms, one number per line) and import it here, or you can use a probability distribution to simulate request times (see below where setting req_durations_in_ms)
# rq = read.table("~/Downloads/request_times.txt", header=FALSE)$V1
# argument notes:
# parallel_router_count is only relevant if router_mode is set to "intelligent"
# choice_of_two, power_of_two, and unicorn_workers_per_dyno are only relevant if router_mode is set to "naive"
# you can only select one of choice_of_two, power_of_two, and unicorn_workers_per_dyno
run_simulation = function(router_mode = "naive",
reqs_per_minute = 9000,
@jakeonrails
jakeonrails / Ruby Notepad Bookmarklet
Created January 29, 2013 18:08
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
@jashmenn
jashmenn / .gdbinit
Created November 14, 2012 01:25
gdb ruby
define session-ruby
source ~/.gdb/ruby
end
define uberrubydebug
set unwindonsignal on
thread apply all bt
session-ruby
redirect_stdout
eval "puts '=====================' + Process.pid.to_s"
@dfm
dfm / LICENSE
Last active September 29, 2024 08:40
XKCD-style plots in d3
Copyright (c) 2012–2013 Daniel Foreman-Mackey
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@mdekstrand
mdekstrand / pdf-thumbnail.sh
Created February 1, 2012 17:56
Generate thumbnails of PDF files
#!/bin/sh
for file in "$@"; do
outfile="${file%%.pdf}.jpg"
echo "Thumbnailing $file to $outfile"
convert -resize 300 "$file[0]" "$outfile"
done
@Toruhs
Toruhs / mc.c
Created February 1, 2012 17:09
Monte Carlo Method
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
double area, pi, x, y, n, N, i;
n = 0;
N = 100000000;
diff --git a/Makefile.in b/Makefile.in
index a01faae..ff05dae 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -297,6 +297,10 @@ enc/unicode/name2ctype.h: enc/unicode/name2ctype.kwd
@$(ECHO) preprocessing $<
$(Q) $(CPP) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -E $< > $@
+probes.h:
+ @$(ECHO) translating probes $<