Skip to content

Instantly share code, notes, and snippets.

View kshitijdeota's full-sized avatar

KD kshitijdeota

View GitHub Profile
@chrisguitarguy
chrisguitarguy / jquery-tabs.html
Created September 23, 2011 15:17
Generic jQuery tab navigation
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('ul.tab-nav li').click(function(e){
var tab_id = jQuery(this).attr('id');
jQuery('ul.tab-nav li').removeClass('active');
$(this).addClass('active');
jQuery('.tab-container div.tab').hide();
jQuery('.tab-container div#' + tab_id + '-tab').show();
});
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@chrislacy
chrislacy / gist:5646240
Last active April 23, 2018 13:57
Icon pack makers wanting to implement 'apply icon pack' functionality for Action Launcher should just include this snippet as appropriate.
Button actionLauncherButton = (Button) findViewById(R.id.action_launcher_button);
actionLauncherButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Check Action Launcher is installed
Intent intent = getPackageManager().getLaunchIntentForPackage("com.actionlauncher.playstore");
if (intent != null) {
// TODO BY YOU: set this package name as appropriate. Eg "kov.theme.stark"
String yourPackageName = ;
@dukeofharen
dukeofharen / gist:e2c60b4478408b53d743
Last active June 18, 2023 19:20
WordPress like shortcode parser for PHP
<?php
//The content which should be parsed
$content = '<p>Hello, my name is John an my age is [calc-age day="4" month="10" year="1991"].</p>';
$content .= '<p>Hello, my name is Carol an my age is [calc-age day="26" month="11" year="1996"].</p>';
//The array with all the shortcode handlers. This is just a regular associative array with anonymous functions as values. A very cool new feature in PHP, just like callbacks in JavaScript or delegates in C#.
$shortcodes = array(
"calc-age" => function($data){
$content = "";
//Calculate the age
@roachhd
roachhd / quick-ref-jekyll-markdown.md
Created November 11, 2014 09:15
Jekyll Markdown Quick Reference

#Jekyll Markdown Quick Reference

####Write in simply awesome markdown

layout: post
title: Markdown Style Guide
---
@williamahartman
williamahartman / FrameRate.java
Created January 15, 2015 03:17
Display framerate in a LibGDX graphics window. Call update() and render() in your main render method.
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.utils.Disposable;
import com.badlogic.gdx.utils.TimeUtils;
/**
* A nicer class for showing framerate that doesn't spam the console
* like Logger.log()
@wesbos
wesbos / settings.json
Created July 21, 2015 13:46
Wes Bos' Sublime Text Settings
{
"added_words":
[
"Mockup",
"plugins",
"coffeescript",
"sourcemaps",
"html",
"plugin",
"init",
@EvanHerman
EvanHerman / check-if-element-in-viewport-on-scroll.js
Last active December 20, 2024 14:34
Check when an element comes into view (jQuery)
function isOnScreen(elem) {
// if the element doesn't exist, abort
if( elem.length == 0 ) {
return;
}
var $window = jQuery(window)
var viewport_top = $window.scrollTop()
var viewport_height = $window.height()
var viewport_bottom = viewport_top + viewport_height
var $elem = jQuery(elem)
@ethicka
ethicka / localhost-ssl.md
Last active April 12, 2024 12:26 — forked from jonathantneal/README.md
Local virtualhost SSL websites on Mac OS Sierra

Local virtualhost SSL websites on Mac OS Sierra

These instructions will guide you through the process of setting up a wildcard SSL for your local virtualhosts for offline development. Most importantly, this configuration will give you the happy, green lock in Chrome.

These instructions have only been tested on Mac OS Sierra using the pre-installed Apache and PHP versions. These instructions also assume you have virtualhosts set up locally already.


Configuring SSL

@mpatel3
mpatel3 / jQuery.md
Last active June 19, 2023 12:14
jQuery coding Standards and Practices

##jQuery Best Coding Practices and Standards

  • Always try to use a CDN to include jQuery on your page. CDN Benefits
    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
    <script>window.jQuery || document.write('<script src="js/jquery-2.1.4.min.js" type="text/javascript"><\/script>')</script>
    
    <!-- Second line is for backup of the first one -->