Skip to content

Instantly share code, notes, and snippets.

@gorork
gorork / gist:b18c07205cf862291a64
Last active August 29, 2015 14:10
P2: JavaScript Challenge #1
var getRelationship = function(x, y) {
// If both arguments are numbers
if ( !isNaN(x) && !isNaN(y) ) {
if ( x == y ) { // if they are equal, return '='
return '=';
} else { // if not, return comparison operator
return x < y ? '<' : '>';
@jonathantneal
jonathantneal / README.md
Last active March 19, 2024 23:31
Local SSL websites on macOS Sierra

Local SSL websites on macOS Sierra

These instructions will guide you through the process of setting up local, trusted websites on your own computer.

These instructions are intended to be used on macOS Sierra, but they have been known to work in El Capitan, Yosemite, Mavericks, and Mountain Lion.

NOTE: You may substitute the edit command for nano, vim, or whatever the editor of your choice is. Personally, I forward the edit command to Sublime Text:

alias edit="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
@natelandau
natelandau / .bash_profile
Last active April 30, 2024 18:07
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@ihorvorotnov
ihorvorotnov / get-social-shares
Last active October 20, 2020 12:15
Get number of shares from social platforms
Facebook*:
https://api.facebook.com/method/links.getStats?urls=%%URL%%&format=json
+ works, returns shares, likes, comments and total
Twitter:
http://urls.api.twitter.com/1/urls/count.json?url=%%URL%%&callback=twttr.receiveCount
+ v1 API but still works
Reddit:
http://buttons.reddit.com/button_info.json?url=%%URL%%
@munirkamal
munirkamal / Wordpress - Track and Display post views.php
Last active April 12, 2018 23:45
Wordpress snippet to track and display post or page views in your wordpress website without using any plugin.
/*******************************************************/
/ Shared by www.codewordpress.com /
/ Add following code to Function.php file in your theme /
/*******************************************************/
<?php
function getPostViews($postID){
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
@jfloff
jfloff / mamp.md
Last active March 6, 2024 09:43
How to get MAMP to work with SSL ... Yes really.

First of all you need to be able to run MAMP in port 80. This is a "heat check" if you don't have any process jamming http ports. You can check it like this:

sudo lsof | grep LISTEN

If you do happen to have any process with something like this *:http (LISTEN), you are in trouble. Before with adventure check if it isn't MAMP itself (yeah, you should close that beforehand)

ps <pid of that process>

If you don't see MAMP, you are in good hands, I have just the thing for you:

SMACSS + Sass + BEM

SMACSS

Scalable and
Modular
Architecture for
C
S
S

@revolunet
revolunet / angularjs.md
Last active October 22, 2021 00:36
BeerJS + AngularJS Paris le 25/2

AngularJS best ressources

Following the AngularJS PARIS meetup (25/2 à 19h à Paris with @sampaccoud @dzen @_kemar @tchack13 @vinz et @revolunet)

Here's our best AngularJS ressources : twitter, github, articles & blogs. Please comment and add your good stuff !

@JeffCost
JeffCost / Git update-index --assume-unchanged.md
Created October 6, 2012 05:47 — forked from grafikchaos/Git update-index --assume-unchanged
Ignore uncommitted changes in tracked files with Git

IGNORE LOCAL CHANGES

Ignore local changes to repository files or directories git update-index --assume-unchanged path/to/file/or/directory

ALIAS

Or you can alias it in your ~/.gitconfig [alias] au = update-index --assume-unchanged

UN-IGNORE LOCAL CHANGES

@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/