Skip to content

Instantly share code, notes, and snippets.

View abbood's full-sized avatar
💭
Leading Village.do tech team

Abdullah Bakhach abbood

💭
Leading Village.do tech team
View GitHub Profile
@abbood
abbood / gist:5347252
Last active December 16, 2015 00:19
var page = new WebPage(), testindex = 0, loadInProgress = false;
page.onConsoleMessage = function(msg) {
console.log(msg);
};
page.onLoadStarted = function() {
loadInProgress = true;
console.log("load started");
};
var content;
var casper = require('casper').create();
function getContent() {
return document.querySelectorAll('html')[0].outerHTML;
}
casper.start('https:site/login.html', function() {
// search for 'casperjs' from google form
this.fill('form[method="post"]', { 'login': 'login', 'passwd': 'pwd' }, true);
@abbood
abbood / gist:5403092
Created April 17, 2013 09:46
PSPDFkit pdf flattening and saving
// pdf delivery
-(void)deliverPDFAttachment {
NSLog(@"this is attachment path %@", attachmentPath);
NSURL *documentURL = [NSURL fileURLWithPath:attachmentPath];
PSPDFDocument *document = [PSPDFDocument PDFDocumentWithURL:documentURL];
document.editableAnnotationTypes = [NSSet setWithObjects:
PSPDFAnnotationTypeStringLink, // not added by default.
PSPDFAnnotationTypeStringHighlight,
PSPDFAnnotationTypeStringUnderline,
@abbood
abbood / Gemfile.lock
Created April 23, 2013 06:35
this lists the contents of my Gemfile.lock
GEM
remote: http://rubygems.org/
specs:
actionmailer (2.3.5)
actionpack (= 2.3.5)
actionpack (2.3.5)
activesupport (= 2.3.5)
rack (~> 1.0.0)
activerecord (2.3.5)
activesupport (= 2.3.5)
-(void)loadResults:(NSArray*)searchResults {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSMutableArray* elementsToAdd = [NSMutableArray arrayWithCapacity:100];
NSMutableArray* rowsToAdd = [NSMutableArray arrayWithCapacity:100];
@synchronized(self) {
for(NSMutableDictionary* searchResult in searchResults) {
// adding an entry from syncing new items
[elementsToAdd addObject:searchResult];
[rowsToAdd addObject:[NSIndexPath indexPathForRow:self.nResults inSection:0]];
@abbood
abbood / gist:7039483
Created October 18, 2013 10:16
objective C runtime object associations
//
// UIView+Addons.m
// Breeze
//
// Created by Abdullah Bakhach on 5/15/13.
//
//
#import "NSObject+Addons.h"
#import <objc/runtime.h>
@abbood
abbood / gist:7500976
Last active December 28, 2015 12:29
this is an example of where I use many constraints all at once.. I like the visual format language b/c it provides a nice summary of things without being too verbose.. obviously addConstraintFormats is a method I created.. but that's besides the point
[self.overallContainerView addConstraintFormats:@[[NSString stringWithFormat:@"V:[overallContainer(>=%f)]",overallContainerHeight],
[NSString stringWithFormat:@"V:[iconsContainer]-%f-|",(imageSize.height+ kLargePadding*2)],
@"V:[selectedContainer(==35)]-0-|",
@"|-10-[selectedContainer(>=300)]",
@"V:[tagWrapper(==tagButton+10)]-35-|",
@"[tagWrapper(==tagButton+30))]",
]
withBindingDict:@{@"overallContainer":_overallContainerView,
@"iconsContainer":_iconsContainerView,
@abbood
abbood / gist:7702597
Created November 29, 2013 07:32
ffmpeg conversion failure
ffmpeg -i "A State of Trance #637.mp4" "A State of Trance #637.mp3"
ffmpeg version N-58502-g738ebb4 Copyright (c) 2000-2013 the FFmpeg developers
built on Nov 28 2013 10:55:55 with Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn)
configuration:
libavutil 52. 55.100 / 52. 55.100
libavcodec 55. 44.100 / 55. 44.100
libavformat 55. 21.102 / 55. 21.102
libavdevice 55. 5.102 / 55. 5.102
libavfilter 3. 91.100 / 3. 91.100
libswscale 2. 5.101 / 2. 5.101
@abbood
abbood / Gemfile
Created December 6, 2013 08:24
gemfile of 'a' project
source 'https://rubygems.org'
gem 'rails', '3.2.13'
group :development do
gem 'capistrano'
gem 'capistrano-ext'
gem 'rvm-capistrano'
end
@abbood
abbood / gist:7853629
Created December 8, 2013 05:25
trying to check if bundler is using system ruby.. as per the comment to [this](http://stackoverflow.com/a/10574436/766570) answer
$ cat $(which bundle)
#!/usr/bin/env ruby_executable_hooks
#
# This file was generated by RubyGems.
#
# The application 'bundler' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'