Skip to content

Instantly share code, notes, and snippets.

View webdevotion's full-sized avatar

Bram Plessers webdevotion

View GitHub Profile
@webdevotion
webdevotion / pixelmator-pro-layers-in-folders-export-to-images.scpt
Last active July 13, 2021 09:44
Applescript for Pixelmator Pro documents to export all layers in nested folders as images files.
on list2string(theList, theDelimiter)
-- First, we store in a variable the current delimiter to restore it later
set theBackup to AppleScript's text item delimiters
-- Set the new delimiter
set AppleScript's text item delimiters to theDelimiter
-- Perform the conversion
set theString to theList as string
@registerTask 'generateRandomLengthFile', () ->
# Generate random length file
var myRandomLengthString = 'todo'
# Write the file
scssfile = grunt.file.write("my-includes-folder/includes.html", myRandomLengthString)
@yoichitgy
yoichitgy / mergegenstrings.py
Last active July 9, 2022 23:59
A script to generate .strings file for .swift, .m, .storyboard and .xib files by genstrings and ibtool commands, and merge them with existing translations.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Localize.py - Incremental localization on XCode projects
# João Moreno 2009
# http://joaomoreno.com/
# Modified by Steve Streeting 2010 http://www.stevestreeting.com
# Changes
# - Use .strings files encoded as UTF-8
@lukeredpath
lukeredpath / UITextField+RACKeyboardSupport.m
Last active April 19, 2017 10:36
ReactiveCocoa signal for keyboard done button taps
#import "UITextField+RACKeyboardSupport.h"
#import <ReactiveCocoa/RACEXTScope.h>
#import <ReactiveCocoa/NSObject+RACDescription.h>
@implementation UITextField (RACKeyboardSupport)
- (RACSignal *)rac_keyboardReturnSignal {
@weakify(self);
return [[[[RACSignal
defer:^{
@Inferis
Inferis / CommonMacros.h
Last active February 5, 2018 03:01
Common Macros for Xcode projects.
//
// CommonMacros.h
// Created by Tom Adriaenssen (@inferis)
// Inspired by the awesome work by Piet Jaspers (@pjaspers)
//
/*
* How to use this file:
* 1. Find your .pch file
* 2. Import this file
@SabretWoW
SabretWoW / rspec_model_testing_template.rb
Last active September 23, 2024 03:01
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@pboling
pboling / facebook_throttle.rb
Last active July 10, 2018 14:47
Facebook API Rate Limit Throttler using Sidekiq, does not execute the job inside the lock, to maintain some semblance of performance, just marks it in a counter, which other jobs from the same queue and using the same token will also update, and which will be throttled. Jobs from other queues will not be able to bust the lock until the timer run…
# Mixin to (i.e. include in) any worker class that does FB API calls and should be throttled.
module FacebookThrottle
def perform_throttled(*args, &block)
options = args.extract_options!
user = User.find_by_fb_uid(options[:fb_uid])
if user
if !user.valid_facebook_token? # A bitwise flag managed by flag_shih_tzu gem
puts "Skipping #{self.class} #{user.fb_uid}: Invalid Oauth Token for #{user}"
return false
@alexhajdu
alexhajdu / UIImageView+Rotate.h
Last active December 13, 2018 20:33
UPDATE: Added stop, pause and resume animation methods. UIImageView category - 360° rotating with duration and repeat count. USAGE: [_myImageView rotate360WithDuration:1.0 repeatCount:0]; //0 for infinite loop
//
// Created by Alex Hajdu on 5/27/13.
// Copyright (c) 2013 Mr.Fox and friends. All rights reserved.
//
// To change the template use AppCode | Preferences | File Templates.
//
#import <Foundation/Foundation.h>
@webdevotion
webdevotion / .bash_profile
Last active December 21, 2020 10:17
Fancy bash shell
# READ MORE HERE: http://www.webdevotion.be/blog/2012/06/06/terminal-git-branch-status-colored-icons
# ==============================================================================
# FANCY GIT STATUS ICONS
# ==============================================================================
# SOME VARIABLES in capitals
# no whitespace between variable names and = sign!
COLOR_RESET="\e[00m"
COLOR_GREEN="\e[1;32m"
COLOR_RED="\e[00;31m"
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :api
draw :account
draw :session