Skip to content

Instantly share code, notes, and snippets.

Avatar
😇
Launched my first mac app –– Presentify

Ram rampatra

😇
Launched my first mac app –– Presentify
View GitHub Profile
@SimoneStefani
SimoneStefani / AESenc.java
Last active Jun 14, 2020
Example of AES encryption and decryption in Java
View AESenc.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.
*/
@GJNilsen
GJNilsen / FlatButton.swift
Last active Apr 11, 2020
Subclass of NSButton
View FlatButton.swift
import AppKit
public class FlatButton: NSButton {
public var buttonColor: NSColor = NSColor(calibratedRed: 0.201, green: 0.404, blue: 0.192, alpha: 1)
public var onClickColor: NSColor = NSColor(calibratedRed: 0.304, green: 0.601, blue: 0.294, alpha: 1)
public var textColor: NSColor = NSColor.white
public override func draw(_ dirtyRect: NSRect) {
super.draw(dirtyRect)
@chinchang
chinchang / xmlToJson.js
Last active Aug 26, 2020
Function to convert XML to JSON
View xmlToJson.js
/**
* Changes XML to JSON
* Modified version from here: http://davidwalsh.name/convert-xml-json
* @param {string} xml XML DOM tree
*/
function xmlToJson(xml) {
// Create the return object
var obj = {};
if (xml.nodeType == 1) {
@tamouse
tamouse / input.md-text
Last active Feb 29, 2020
Adding a class to a table in markdown (using kramdown processor as default in Jekyll).
View input.md-text
# Let's try out a table with kramdown class tag
| A simple | table |
| with multiple | lines|
{: .my-class }
@ManuelPeinado
ManuelPeinado / MainActivity.java
Created Oct 19, 2014
Fading action bar effect using the new Toolbar class from the support library
View MainActivity.java
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;
@itarato
itarato / encryption.java
Created Sep 28, 2014
Java AES CBC encryption example
View encryption.java
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 {
@nurinamu
nurinamu / tag_img.rb
Created Sep 7, 2014
jekyll plugin for custom size img tag.
View tag_img.rb
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
@staltz
staltz / introrx.md
Last active Sep 19, 2020
The introduction to Reactive Programming you've been missing
View introrx.md
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active Sep 19, 2020
how to delete a git tag locally and remote
View git-tag-delete-local-and-remote.sh
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@HaNdTriX
HaNdTriX / image_to_data_url.js
Last active Jul 2, 2020
Convert an image to base64URL.
View image_to_data_url.js
/**
* 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
*
You can’t perform that action at this time.