Skip to content

Instantly share code, notes, and snippets.

View jagroop's full-sized avatar
👨‍💻
At Office

Jagroop Singh jagroop

👨‍💻
At Office
View GitHub Profile
@dennysfredericci
dennysfredericci / search-ul-li-item.js
Created July 22, 2014 18:19
A simple jquery code to search a text inside of li tag
//searchText is a input type text
$('#searchText').bind('keyup', function() {
var searchString = $(this).val();
$("ul li").each(function(index, value) {
currentName = $(value).text()
if( currentName.toUpperCase().indexOf(searchString.toUpperCase()) > -1) {
@joshhartman
joshhartman / mcrypt-cbc.php
Last active April 20, 2022 08:44
Rijndael 256-bit Encryption Function (CBC)
<?php
// Define a 32-byte (64 character) hexadecimal encryption key
// Note: The same encryption key used to encrypt the data must be used to decrypt the data
define('ENCRYPTION_KEY', 'd0a7e7997b6d5fcd55f4b5c32611b87cd923e88837b63bf2941ef819dc8ca282');
// Encrypt Function
function mc_encrypt($encrypt, $key){
$encrypt = serialize($encrypt);
$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC), MCRYPT_DEV_URANDOM);
$key = pack('H*', $key);
@maxparm
maxparm / instagram.php
Created April 3, 2012 17:42
PHP - Request Instagram api with PHP/Curl
<?php
//Get data from instagram api
$hashtag = 'max';
//Query need client_id or access_token
$query = array(
'client_id' => '',
'count' => 3
);
$url = 'https://api.instagram.com/v1/tags/'.$hashtag.'/media/recent?'.http_build_query($query);
@FrostyX
FrostyX / FacebookDebugger.php
Last active February 9, 2022 11:15
Facebook API - Force facebook to reload cache from your website
<?php
class FacebookDebugger
{
/*
* https://developers.facebook.com/docs/opengraph/using-objects
*
* Updating Objects
*
* When an action is published, or a Like button pointing to the object clicked,
* Facebook will 'scrape' the HTML page of the object and read the meta tags.
@chill117
chill117 / mysql_backup.sh
Last active December 13, 2021 22:02
Bash script to perform backups on one or more MySQL databases.
#!/bin/bash
#
# Use this script to perform backups of one or more MySQL databases.
#
# Databases that you wish to be backed up by this script. You can have any number of databases specified; encapsilate each database name in single quotes and separate each database name by a space.
#
# Example:
# databases=( '__DATABASE_1__' '__DATABASE_2__' )
@accentinteractive
accentinteractive / dump_helper.php
Created October 5, 2012 07:09
dump_helper: functions to dump variables to the screen, in a nicley formatted manner
<?php
/**
* Dump helper. Functions to dump variables to the screen, in a nicley formatted manner.
* @author Joost van Veen
* @version 1.0
*/
if (!function_exists('dump')) {
function dump ($var, $label = 'Dump', $echo = TRUE)
{
// Store dump in variable
@adnan-i
adnan-i / mongoose-aggregate-by-month-year.js
Last active October 22, 2020 15:30
Mongoose aggregation for grouping users by month/year subscribed
User.aggregate([
{
/* Filter out users who have not yet subscribed */
$match: {
/* "joined" is an ISODate field */
'subscription.joined': {$ne: null}
}
},
{
/* group by year and month of the subscription event */
@codeincontext
codeincontext / gist:3862543
Created October 10, 2012 01:11
Photo capture, manipulation, and upload in iOS6 Safari
<!DOCTYPE html>
<html>
<head>
<title>iOS6 Safari Photo Capture Demo</title>
<script type="text/javascript">
window.onload = function() {
var input = document.getElementById("input");
input.addEventListener("change", handleFile);
}
@shawnlindstrom
shawnlindstrom / TwilioServiceProvider.php
Created July 4, 2018 03:00
Twilio Service Provider for Laravel
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Twilio\Rest\Client as TwilioService;
class TwilioServiceProvider extends ServiceProvider
{
public function register()