Skip to content

Instantly share code, notes, and snippets.

@cherifya
cherifya / gist:cdefb33b97c6f2926a0c28ece5c22677
Created August 11, 2021 04:43 — forked from adamstac/gist:7462202
Install and configure Sendmail on Ubuntu

Install and configure Sendmail on Ubuntu

This should help you get Sendmail installed with basic configuration on Ubuntu.

  1. If sendmail isn't installed, install it: sudo apt-get install sendmail
  2. Configure /etc/hosts file: nano /etc/hosts
  3. Make sure the line looks like this: 127.0.0.1 localhost yourhostname
  4. Run Sendmail's config and answer 'Y' to everything: sudo sendmailconfig
  5. Restart apache sudo service apache2 restart
@cherifya
cherifya / UIImageView+Webcache_Animation.c
Last active December 27, 2016 07:10
Improve SDWebImage library with support for a UIActivityIndicator and optional image transition. The transition animation is a simple fade-in.
//
// 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"
- (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 December 26, 2015 14:59
LEColorPicker.podspec for v1.0
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'
/*
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
$(function() {
var $sidebar = $("#sidebar"),
$window = $(window),
offset = $sidebar.offset(),
topPadding = 20;
$window.scroll(function() {
if ($window.scrollTop() > offset.top) {
$sidebar.stop().animate({
// 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({
@cherifya
cherifya / for=()-{}-(faster).snippet
Created April 24, 2013 13:23
Sublime Text 2 Snippets
<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>
  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
  1. Install to your app npm install nodetime
  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