Skip to content

Instantly share code, notes, and snippets.

View HazemNoor's full-sized avatar

Hazem Noor HazemNoor

View GitHub Profile
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active May 16, 2024 16:51
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@mikker
mikker / gist:631106
Created October 17, 2010 18:30
Update all packages installed with homebrew
brew update && brew upgrade && brew cleanup
@v9n
v9n / get_est_time.php
Created December 20, 2010 07:51
Get EST TIME
<?php
//EST is 3 hours foward of LA time
date_default_timezone_set('America/Los_Angeles');
$date = date("Y-m-d", time() + 3600 * 3);
@olivierlacan
olivierlacan / An_example.markdown
Created February 18, 2012 05:40 — forked from renz45/An_example.markdown
Re-style Sublime Text 2 sidebar to a darker theme

This re-styles your sublime text 2 sidebar to be darker, so it doesn't blind you when using a dark theme.

Dark sublime text 2 sidebar

Save the Default.sublime-theme file into packages/Theme - Default, make a backup of your original if you want to be able to go back easily.

@jonathonbyrdziak
jonathonbyrdziak / taxmeta.class.php
Created February 22, 2012 18:17
Taxonomy Metaboxes, allows you to create additional taxonomy metas, including images.
<?php
/**
* @Author Anonymous
* @link http://www.redrokk.com
* @Package Wordpress
* @SubPackage RedRokk Library
* @copyright Copyright (C) 2011+ Redrokk Interactive Media
*
* @version 2.0
*/
@xeoncross
xeoncross / index.php
Created March 8, 2012 17:31
Tiny, SMTP client in PHP
<?php
/*
This is a very tiny proof-of-concept SMTP client. Currently it's over 320 characters (if the var names are compressed). Think you can build one smaller?
*/
ini_set('default_socket_timeout', 3);
$user = 'you@gmail.com';
$pass = '';
$host = 'ssl://smtp.gmail.com';
@Kevinlearynet
Kevinlearynet / Popular Posts This Month
Created October 8, 2012 13:52
Popular Posts Tracking
@tawfekov
tawfekov / generator.php
Last active March 2, 2024 16:06
Doctrine2 Generate Entities form Existing Database
<?php
include '../vendor/autoload.php';
$classLoader = new \Doctrine\Common\ClassLoader('Entities', __DIR__);
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Proxies', __DIR__);
$classLoader->register();
// config
$config = new \Doctrine\ORM\Configuration();
@msg555
msg555 / gangnam.py
Created January 27, 2013 21:21
Create plots from discrete set of points. It's set to connect the first and last point together, currently.
#!/usr/bin/python
#
# Example usage
# $ ./gangnam.py | gnuplot
# 9
# 0 0
# 1 1
# 2 2
# 0 2
# 1 1
@paulund
paulund / cache-pages-with-php.php
Created June 25, 2013 18:27
Here is a quick code snippet which will allow you to easily cache pages in PHP.
<?php
//cache file
$cachefile = 'cached/'.date('M-d-Y').'.php';
//Total time the file will be cached in seconds set to 10 hours
$cachetime = 36000;
//If the cache file already exists and the cache file is over 10hours old then display the cache file
if (file_exists($cachefile) && time() - $cachetime < filemtime($cachefile)) {
include($cachefile);