Skip to content

Instantly share code, notes, and snippets.

View ArupSen's full-sized avatar
🏠
Working from home

Arup Sen ArupSen

🏠
Working from home
View GitHub Profile
@ArupSen
ArupSen / wordpress_template.php
Created July 9, 2012 15:21
Wordpress custom template file header
<?php /* Template Name: UsuallyPageName */ ?>
@ArupSen
ArupSen / twitter_update.html
Created July 9, 2012 18:17
HTML and css for showing one tweet
<style type="text/css">
#twitter_update_list li {
list-style-type: none;
}
#twitter_update_list {
font-size:0.82em;
width:138px;
position:relative;
left:207px;
bottom:79px;
@ArupSen
ArupSen / onclick.html
Created July 11, 2012 10:06
Use inline javascript onclick to open link in new window or tab
<a href="http://www.bigmustard.co.uk/models/view/dik-cadbury/622" title=" Dik's profile at Mustard Casting in a new window" onclick="window.open('http://www.bigmustard.co.uk/models/view/dik-cadbury/622');return false">Mustard Models</a>
@ArupSen
ArupSen / twitter.js
Created August 4, 2012 20:32
twitterCallback2 for getting tweets to be embedded on your site
function twitterCallback2(twitters) {
var statusHTML = [];
for (var i=0; i<twitters.length; i++){
var username = twitters[i].user.screen_name;
var status = twitters[i].text.replace(/((https?|s?ftp|ssh)\:\/\/[^"\s\<\>]*[^.,;'">\:\s\<\>\)\]\!])/g, function(url) {
return '<a href="'+url+'">'+url+'</a>';
}).replace(/\B@([_a-z0-9]+)/ig, function(reply) {
return reply.charAt(0)+'<a href="http://twitter.com/'+reply.substring(1)+'">'+reply.substring(1)+'</a>';
});
statusHTML.push('<li><span>'+status+'</span> <a style="font-size:85%" href="http://twitter.com/'+username+'/statuses/'+twitters[i].id_str+'">'+relative_time(twitters[i].created_at)+'</a></li>');
@ArupSen
ArupSen / functions.php
Created September 2, 2012 10:58
Use jquery on a wordpress site
<? php
function my_init() {
if (!is_admin()) {
// comment out the next two lines to load the local copy of jQuery
wp_deregister_script('jquery');
wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js', false, '1.5.2');
wp_enqueue_script('jquery');
}
}
add_action('init', 'my_init');
@ArupSen
ArupSen / .vimrc
Last active October 11, 2015 05:47
Vimrc ideas
" Plugin stuff
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
@ArupSen
ArupSen / index.html
Created October 16, 2012 23:11
draft of erick rinner site
<!DOCTYPE html>
<html>
<head>
<title>Moksha coaching - Personal Development Partner</title>
<meta name="robots" content="noindex, nofollow" />
<meta name="description" content="Personal Development Partner" />
<style type="text/css">
body {font-family: "Lucida Grande", Lucida, sans-serif;margin:0 auto;/*background:url('images/skybg2.jpg') no-repeat 50% 0 #18376b;*/font-size:12px;color:#666;}
#wrap {background-color: #FFF;padding:0px 0px 20px 0px;position:relative;width: 660px;margin:0 auto;}
ul {margin-left:0px;padding-left:2em;}
@ArupSen
ArupSen / util.js
Created November 1, 2012 22:24 — forked from pamelafox/util.js
JavaScript Utility Libraries (Scroll down!)
var ED = ED || {};
// Utility functions
ED.util = (function() {
// Data structure functions
function each(object, callback) {
if (object === null) return;
@ArupSen
ArupSen / output_numbers.php
Created November 14, 2012 15:59
extract numbers from string regexp
// To remove anything that is not a number:
$output = preg_replace('/[^0-9]/', '', $input);
/*
Explanation:
[0-9] matches any number between 0 and 9 inclusively.
^ negates a [] pattern.
So, [^0-9] matches anything that is not a number, and since we're using preg_replace, they will be replaced by nothing '' (second argument of preg_replace).
*/
@ArupSen
ArupSen / errors.php
Created November 15, 2012 10:15
PHP error reporting
// error handling - switch off (comment out) after testing
ini_set('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);