Skip to content

Instantly share code, notes, and snippets.

View nask0's full-sized avatar
👾
nothing

nask0 nask0

👾
nothing
  • ...somewhere in time!
View GitHub Profile
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@domenic
domenic / promises.md
Last active March 31, 2024 14:07
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@jadb
jadb / cli.args.php
Created October 25, 2012 01:25
Parse PHP CLI arguments
http://pwfisher.com/nucleus/index.php?itemid=45
This command line option parser supports any combination of three types of options (switches, flags and arguments) and returns a simple array.
<?php
/**
* CommandLine class
*
* @package Framework
*/
/**
@thomaspark
thomaspark / subnav.css
Last active June 6, 2023 10:19
Subnav for Bootstrap 2
section {
padding-top: 60px;
}
.subnav {
margin-bottom: 60px;
width: 100%;
height: 36px;
background-color: #eeeeee; /* Old browsers */
background-repeat: repeat-x; /* Repeat the gradient */
@JamieMason
JamieMason / is_installed.sh
Last active February 17, 2024 10:12
Check if a program exists from a bash script.Thanks to twitter.com/joshnesbitt and twitter.com/mheap for the help with detecting npm packages.
#!/bin/bash
# Functions ==============================================
# return 1 if global command line program installed, else 0
# example
# echo "node: $(program_is_installed node)"
function program_is_installed {
# set to 1 initially
local return_=1
#!/bin/bash
# Downtimes are third Sunday of the month. In order to plan
# for upgrades and reboots, we email ourselves the list of all
# outstanding security updates for each system on the 2nd
# Wednesday of the month.
# Critical security update alerts are sent daily.
# Requires yum-plugin-security and mailx.
WEEKOFMONTH=$((($(date +%d)-1)/7+1))
DAYOFWEEK=$(date +%u)
@nirbheek
nirbheek / set_gnome-terminal_transparency.sh
Last active March 6, 2024 09:41
A tiny script to set the transparency for X windows. If AUTOMAGIC_MODE is "true", it tries to find all gnome-terminal windows and applies the transparency to all of them.
#!/bin/bash
# vim: set sts=4 sw=4 et tw=0 :
#
# License: BSD
AUTOMAGIC_MODE="true"
OPACITY_100="0xffffffff"
OPACITY_0="0x0"
: ${XWININFO:=$(type -P xwininfo)}
@laurentiuc
laurentiuc / addThis-directives.js
Last active February 8, 2017 19:29
AngularJS addThis directive
angular.module('myApp').directive('addthisToolbox', ['$timeout', function($timeout) {
return {
restrict : 'A',
transclude : true,
replace : true,
template : '<div ng-transclude></div>',
link : function($scope, element, attrs) {
$timeout(function () {
addthis.init();
addthis.toolbox($(element).get(), {}, {
@denji
denji / Phalcon-Zephir.md
Last active February 24, 2023 03:02
Zephir write your PHP Extension

About this article will do the following things:

  • Install & Setup
  • Write a simple Router
  • Zephir rewritten version
  • Extension installation and testing

Installation