Skip to content

Instantly share code, notes, and snippets.

Cherif YAYA cherifya

Block or report user

Report or block cherifya

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View afnetworking_downloadFile_example.m
- (IBAction)downloadFile:(id)sender {
NSURL *url = [NSURL URLWithString:@"http://www.hulkshare.com/dl/qw30o7x373a8/stan_courtois_&_felly_vs_cutting_crew_-_die_in_your_arms_(x-centrik_mix)_%5B_www.themusix.net_%5D.mp3"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
NSString *fullPath = [NSTemporaryDirectory() stringByAppendingPathComponent:[url lastPathComponent]];
[operation setOutputStream:[NSOutputStream outputStreamToFileAtPath:fullPath append:NO]];
@cherifya
cherifya / LEColorPicker.podspec
Last active Dec 26, 2015
LEColorPicker.podspec for v1.0
View LEColorPicker.podspec
Pod::Spec.new do |s|
s.name = "LEColorPicker"
s.version = "1.0"
s.summary = "A Cocoa-Touch system for iOS to get a color scheme in function of an image, like iTunes 11 does."
s.homepage = "https://github.com/luisespinoza/LEColorPicker"
s.license = 'MIT'
s.author = { "Luis Enrique Espinoza Severino" => "luis.espinoza.severino@gmail.com" }
s.platform = :ios
s.source = { :git => "https://github.com/luisespinoza/LEColorPicker.git", :tag => "v1.0" }
s.source_files = 'LEColorPicker'
View levenshtein.js
/*
Copyright (c) 2011 Andrei Mackenzie
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 copies or substantial portions of the Software.
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 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
View jquery-scroll-follow-sidebar-idea.js
$(function() {
var $sidebar = $("#sidebar"),
$window = $(window),
offset = $sidebar.offset(),
topPadding = 20;
$window.scroll(function() {
if ($window.scrollTop() > offset.top) {
$sidebar.stop().animate({
View BestFitGridView.js
// A (quick and dirty) view which renders its content as a best-fit grid – that is, it shows all items,
// laid out as close to evenly as possible.
// Known issues:
// - doesn't update when content changes (wasn't part of my needs); easy observer fix
// - isn't a subclass of SC.CollectionView
// - someone with the maths could optimize the calculations
// - child views are never destroyed, only created and cached
BestFitGridView = SC.View.extend({
View for=()-{}-(faster).snippet
<snippet>
<content><![CDATA[for (var ${20:i} = 0, ${30:l} = ${1:Things}.length; ${20:i} < ${30:l}; ${20:i}++) {
${100:${1:Things}[${20:i}]}$0
};]]></content>
<tabTrigger>for</tabTrigger>
<scope>source.js</scope>
<description>for (…) {…} (Improved Native For-Loop)</description>
</snippet>
View README.md

Via Profiler

  1. Install globally npm install -g profiler
  2. Start your process with node --prof this will create a v8.log file
  3. Run /usr/local/lib/node_modules/profiler/build/Release/nprof v8.log this will read the v8.log profile and give you nice ouput

Via NodeTime

  1. Install to your app npm install nodetime
View README.md

Via Profiler

  1. Install globally npm install -g profiler
  2. Start your process with node --prof this will create a v8.log file
  3. Build nprof by running /Users/balupton/.nvm/v0.8.12/lib/node_modules/profiler/tools/build-nprof
  4. Run /Users/balupton/.nvm/v0.8.12/lib/node_modules/profiler/nprof this will read the v8.log profile and give you nice ouput

Via NodeTime

@cherifya
cherifya / UIImageView+Webcache_Animation.c
Last active Dec 27, 2016
Improve SDWebImage library with support for a UIActivityIndicator and optional image transition. The transition animation is a simple fade-in.
View UIImageView+Webcache_Animation.c
//
// UIImageView+Webcache_Animation.m
// Tubesmix
//
// Created by Cherif YAYA on 17/03/13.
// Copyright (c) 2013 Cherif YAYA. All rights reserved.
//
#import "UIImageView+Webcache_Animation.h"
@cherifya
cherifya / 1line-notepad
Last active Dec 12, 2015
One line notepad in browser with Save button for saving the snippet. Copy and paste the line in your browser's address bar. And voila!
View 1line-notepad
data:text/html;charset=utf-8, <title>TextEditor</title><body contenteditable style="font-size:1.5rem;font-family:'Monaco', sans-serif;line-height:1.4;max-width:70rem;margin:0 auto;padding:3rem;background-color:rgb(233,233,225);color:rgb(68,68,68);" spellcheck="false"> <textarea id="txtBody" style="font-size: 1.5em; width: 100%; height: 90%; font-family: inherit;" autofocus> </textarea> <button onClick="SaveTextArea()" style="margin-top: 20px; font-size: 1.1em;">Save</button> <script language="javascript" type="text/javascript"> function SaveTextArea() { window.location = "data:application/octet-stream," + escape(txtBody.value); } </script> </body>
You can’t perform that action at this time.