Skip to content

Instantly share code, notes, and snippets.

View rampatra's full-sized avatar
😇
Take your presentation to the next level with Presentify app.

Ram rampatra

😇
Take your presentation to the next level with Presentify app.
View GitHub Profile
@nurinamu
nurinamu / tag_img.rb
Created September 7, 2014 23:13
jekyll plugin for custom size img tag.
module Jekyll
class RenderImgTag < Liquid::Tag
def initialize(tag_name, text, tokens)
super
@url , *@val= text.split(/ /)
if @val.length > 0
@width , *@height = @val[0].split(/x/)
end
@ManuelPeinado
ManuelPeinado / MainActivity.java
Created October 19, 2014 20:02
Fading action bar effect using the new Toolbar class from the support library
package com.github.manuelpeinado.toolbartest;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.View;
@SimoneStefani
SimoneStefani / AESenc.java
Last active August 17, 2021 14:03
Example of AES encryption and decryption in Java
/**
* Code written by P. Gajland
* https://github.com/GaPhil
*
* IMPORTANT:
* This code is for educational and demonstrative purpose only.
* If you need to do serious encryption for "production" it is
* recommended to investigate more traditional libraries and
* gain some specific knowledge on cryptography and security.
*/
@HaNdTriX
HaNdTriX / image_to_data_url.js
Last active February 27, 2022 07:23
Convert an image to base64URL.
/**
* Converts an image to a dataURL
* @param {String} src The src of the image
* @param {Function} callback
* @param {String} outputFormat [outputFormat='image/png']
* @url https://gist.github.com/HaNdTriX/7704632/
* @docs https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement#Methods
* @author HaNdTriX
* @example
*
@pascalpp
pascalpp / UserDefaults+NSColor.swift
Last active March 12, 2022 19:12
Swift 5 extension to add NSColor support to UserDefaults
import Cocoa
extension UserDefaults {
func set(_ color: NSColor, forKey: String) {
if let data = try? NSKeyedArchiver.archivedData(withRootObject: color, requiringSecureCoding: false) {
self.set(data, forKey: forKey)
}
}
import SwiftUI
let width : CGFloat = 82.0
let height : CGFloat = 82.0
struct ContentView: View {
@State private var toggle = false
var body: some View {
VStack {
Spacer()
ZStack {
Image(systemName: "heart.fill")
//
// ContentView.swift
// ColorCodable
//
// Created by Mateo on 5/26/22.
//
import SwiftUI
@tobiasschuerg
tobiasschuerg / FilteredArrayAdapter.java
Created August 31, 2012 15:08
Android Arrayadapter with text filtering for the use with a TextWatcher.
/**
* Arrayadapter (for Android) with text filtering for the use with a TextWatcher.
* Note: the objects in the List need a valid toString() method.
* @author Tobias Schürg
*
*/
public class FilteredArrayAdapter extends ArrayAdapter<ImageObject> {
@itarato
itarato / encryption.java
Created September 28, 2014 18:59
Java AES CBC encryption example
package com.company;
import javax.crypto.Cipher;
import javax.crypto.Mac;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.security.MessageDigest;
import java.security.SecureRandom;
public class Main {
@trungdq88
trungdq88 / paddle-revenue.js
Last active April 6, 2023 14:07
A scriptable's script to get Paddle revenue from multiple accounts using puppeteer.
/*
RUN THE SCRIPT BY YOURSELF:
- Run `node paddle-revenue.js` on your server and let it run 24/7.
- Access the API at http://your_server_ip:8175/ (JSON)
HOSTED VERSION:
If you don't want to run the script by your own, you can use the
hosted version. The price is $5 per month per Paddle account.
Here is how: