Skip to content

Instantly share code, notes, and snippets.

View Ha006's full-sized avatar
😎
Next generation search engine

Henrik Albrechtsson Ha006

😎
Next generation search engine
View GitHub Profile
@ezimuel
ezimuel / decrypt.php
Created April 26, 2018 13:07
Decrypt a file in PHP form an encrypted file with OpenSSL CLI
<?php
/**
* Decrypt a file generated with the command line:
* openssl enc -aes-256-cbc -in file-to-encrypt -out encrypted-file -k password
*
* To decrypt:
* php decrypt.php encrypted-file password decrypted-file
*
* NOTE: this script has been tested with OpenSSL v.1.1, for old version
* please check if you need to use MD5 instead of SHA256 in EVP_BytesToKey()
se nedan
Authorization: Basic U0ZiaW9BUEk6YlNGNVBGSGNSNFoz
..blir Anvädarnamn: SFbioAPI Lösenord: bSF5PFHcR4Z3
@kus
kus / fixIOSAudioContext.js
Last active May 22, 2025 16:45
Fix iOS AudioContext on Safari not playing any audio. It needs to be "warmed up" from a user interaction, then you can play audio with it as normal throughout the rest of the life cycle of the page.
// Fix iOS Audio Context by Blake Kus https://gist.github.com/kus/3f01d60569eeadefe3a1
// MIT license
(function() {
window.AudioContext = window.AudioContext || window.webkitAudioContext;
if (window.AudioContext) {
window.audioContext = new window.AudioContext();
}
var fixAudioContext = function (e) {
if (window.audioContext) {
// Create empty buffer
<?php
function query($method, $resource, $data = array())
{
$api_server = 'https://api.sello.io/v3';
$api_token = 'yourtoken';
$api_key = 'yourkey';
$url = $api_server.'/'.$resource.'?';
if ($method == 'GET' && count($data) > 0) {
foreach ($data as $key => $value) {
@ydn
ydn / node-weather.js
Last active November 19, 2022 15:36
Weather API
var YQL = require('yql');
var query = new YQL('select * from weather.forecast where (location = 94089)');
query.exec(function(err, data) {
var location = data.query.results.channel.location;
var condition = data.query.results.channel.item.condition;
console.log('The current weather in ' + location.city + ', ' + location.region + ' is ' + condition.temp + ' degrees.');
});
@bedeabza
bedeabza / hexhsl.php
Created April 11, 2014 12:10
PHP Hex to HSL and HSL to Hex conversion
function hexToHsl($hex) {
$hex = array($hex[0].$hex[1], $hex[2].$hex[3], $hex[4].$hex[5]);
$rgb = array_map(function($part) {
return hexdec($part) / 255;
}, $hex);
$max = max($rgb);
$min = min($rgb);
$l = ($max + $min) / 2;
@tillsanders
tillsanders / menu-toggle-button-animation.md
Last active March 21, 2016 12:42
Animation for a mobile menu toggle. Three horizontal lines transform into a cross and back again.

Animate the transformation of a mobile menu toggle into a cross

Animation Transition for a mobile menu toggle. Three horizontal lines transform into a cross and back again. The top and bottom lines fall into the center, transforming into one line. The line(s) rotate clockwise, spawning a line at 45deg and stop at 135 deg, forming a cross. Demo: http://jsfiddle.net/SYYr5/84/

Annotations:

  • the animation uses four additional elements inside the a tag. This is not semantic, but we can at least use elements without a semantic meaning, like div and span
  • using a div as a second container, we are able to apply a padding to our a tag
  • We may need to use vendor prefixes :/
@irazasyed
irazasyed / bash_profile.md
Last active March 29, 2025 19:27
Terminal: Mac OS X Terminal Aliases & How-To - .bash_profile / .profile

Mac OS X Terminal Aliases & How-To

Collection of some of my fav terminal aliases that I use often & collected from the web. This file will be updated with more aliases as I find more. Feel free to comment and share your fav aliases you use :)

Follow these simple steps to add them to your shell env.

  1. Within the Terminal, run: vim ~/.bash_profile
  2. Type i and then paste the following at the top of the file:
@FiXato
FiXato / google_plus_single_column_layout_fixes-mozformat.user.css
Last active December 18, 2015 13:19
CSS UserStyle fixes for the latest Google Plus layout as of 2013 Q3. So far only the single column layout is being tweaked.
@-moz-document domain("plus.google.com") {
#I_have_all_the_rules_prefixed_with_nonexisting_ids_to_describe_the_rules_and_to_enforce_correct_rule_orders_for_user_style_engines_that_strip_comments_and_sort_rules_alphabetically {}
}
@-moz-document domain("plus.google.com") {
#_Single_Column_Layout_Section_comment { /* The rules in this section apply to the single column layout */ }
#rule_1a_remove_fixed_width_on_content_columns, .ow > div, .ow .e4CL6 { width: inherit!important; }
#rule_1b_set_maximum_width_on_content_columns, .ow > div { max-width: /*[[max-column-width]]*/!important; }
@jasdeepkhalsa
jasdeepkhalsa / fif.js
Created March 12, 2013 09:59
Friendly iFrames (FIF) - Loading JavaScript Asynchronously Without Blocking window.onload by Stoyan Stefanov. Designed for loading third party scripts only (for first party scripts this script may have a negative performance impact, as tested by Yahoo)
// Documented by Stoyan Stefanov: https://www.facebook.com/note.php?note_id=10151176218703920
(function() {
var url = 'http://example.org/js.js';
var iframe = document.createElement('iframe');
(iframe.frameElement || iframe).style.cssText =
"width: 0; height: 0; border: 0";
iframe.src = "javascript:false";
var where = document.getElementsByTagName('script')[0];
where.parentNode.insertBefore(iframe, where);
var doc = iframe.contentWindow.document;