Skip to content

Instantly share code, notes, and snippets.

View andreiluca's full-sized avatar

Andrei Luca andreiluca

View GitHub Profile
@oodavid
oodavid / README.md
Last active March 11, 2025 21:41 — forked from aronwoost/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@necolas
necolas / .htaccess
Created April 9, 2012 22:19
Simple, quick way to concatenate, minify, and version static files in a Wordpress theme
# Filename-based cache busting
# taken from https://github.com/h5bp/html5-boilerplate/
# This rewrites file names of the form `name.123456.js` to `name.js`
# so that the browser doesn't use the cached version when you have
# updated (but not manually renamed) the file.
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
(function(global) {
var silpUrl = '//s3-eu-west-1.amazonaws.com/silp.shootitlive.com/js/silp.min.js';
// Globals
if(!global.Silp) { global.Silp = {}; };
var Silp = global.Silp;
// To keep track of which embeds we have already processed
if(!Silp.foundEls) Silp.foundEls = [];
@abrudtkuhl
abrudtkuhl / comments.php
Created August 8, 2012 18:05
WordPress comments.php for Responsive Facebook Comments
<div class="fb-comments"data-href="<?php the_permalink(); ?>" data-num-posts="2" mobile="false"></div>
@wutupake
wutupake / url_only.php
Created November 7, 2012 18:22
WP: Next/Previous Post URL only
<?php if (get_adjacent_post(false, '', false)): // if there are newer posts ?>
<a href="<?php echo get_permalink(get_adjacent_post(false,'',false)); ?>" class="article-nav prev">&nbsp;</a>
<?php endif; ?>
<?php if (get_adjacent_post(false, '', true)): // if there are older posts ?>
<a href="<?php echo get_permalink(get_adjacent_post(false,'',true)); ?>" class="article-nav next">&nbsp;</a>
<?php endif; ?>
@burke
burke / x.md
Created December 4, 2012 22:31
Dealing with Github notifications

Or, How I took back my inbox

I've been getting a lot of Github notifications lately. Between work at Shopify, development on Zeus, and all the little things in between, my inbox usually has about 50 github notifications in it.

This is a little annoying.

The problem is, I care about most of those notifications the moment they happen, but I don't interact with them as emails -- I go to github as soon as I get the email and deal with it there. Most of my other email, I don't care so much about it immediately, but it's fairly important that I actually read them eventually. What this tends to cause is a flood of unread notification emails drowning out the important stuff, which I end up ignoring if it falls off the first page.

The solution to this problem for me ended up being really trivial (I didn't even have to code anything!)

anonymous
anonymous / gist:4436930
Created January 2, 2013 19:01
PHP code to display the top 10 posts from 9GAG using the InfiniGAG API.
<?php
$jsonurl = "http://infinigag.eu01.aws.af.cm/";
$json = file_get_contents($jsonurl,0,null,null);
$json_output = json_decode($json, TRUE);
foreach($json_output['images'] as $key => $thisValue)
{
$arrayImage = $thisValue['image'];
$title = $thisValue['title'];
$url = $thisValue['url'];
@davoclavo
davoclavo / vine_hasher.rb
Last active October 15, 2016 20:56
tool to unhash/hash vine ids
module VineHasher
VINE_KEY = 'BuzaW7ZmKAqbhMOei5J1nvr6gXHwdpDjITtFUPxQ20E9VY3Ll'
VINE_KEY_SIZE = VINE_KEY.size
VINE_KEY_HASH = VINE_KEY.split('').each_with_index.inject({}) {|hash, (key, index)| hash[key] = index; hash }
def unhash_id(hashed_id)
hashed_id.reverse.split('').each_with_index.inject(0) { |total, (key, index)| total + VINE_KEY_HASH[key] * VINE_KEY_SIZE**index }
end
def hash_id(id)
@andiraduta
andiraduta / gist:7493431
Created November 15, 2013 23:25
Ia lista de campanii cu lead-uri din 2Parale (ordonate crescator dupa valoarea lead-ului)
<?php
function recursive_campaigns($api_url, &$campaigns, &$page) {
global $url;
$response = file_get_contents($api_url);
$json_obj = json_decode($response);
if( count($json_obj) > 1 ) {
foreach($json_obj as $obj) {
if( $obj->campaign->default_lead_commission_rate != "" ) {
@andiraduta
andiraduta / gist:7591955
Created November 21, 2013 23:37
Quicklink tool in caz ca site-ul 2Parale este nefunctional
<?php
session_start();
$user_2p = ''; // your 2parale user
$pass_2p = ''; // your 2parale pass
function get_page($link) {
global $user_2p, $pass_2p;
$ch = curl_init($link);