Skip to content

Instantly share code, notes, and snippets.

Adam Boro adekbadek

Block or report user

Report or block adekbadek

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@adekbadek
adekbadek / assets-helpers.sh
Last active Feb 1, 2018
some useful assets conversions for websites
View assets-helpers.sh
# convert video to webm
# https://thethemefoundry.com/blog/convert-mp4-to-webm/
ffmpeg -i myvideo.mp4 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis myvideo.webm
# convert between image formats
convert myimg.png myimg.jpg
# convert images to webp
# https://www.npmjs.com/package/webp-converter-cli
# to convert all in current directory:
View meteo-pl.sh
DATE=`date +%Y%m%d`
URL="http://www.meteo.pl/php/meteorogram_list_coamps.php?ntype=2n&fdate=$(echo $DATE)12&row=133&col=96&lang=pl&cname=Warszawa"
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome $URL
View functions.php
<!-- remove link from WP excerpt -->
<!-- https://stackoverflow.com/a/42202343 -->
function new_excerpt_more($more) {
global $post;
remove_filter('excerpt_more', 'new_excerpt_more');
return '';
}
add_filter('excerpt_more','new_excerpt_more', 11);
View webpack.config.hasher.js
// https://github.com/webpack/webpack/issues/86#issuecomment-179957661
// in index.pug, write simply [[app]] if your JS is app.js
var webpack = require('webpack')
var path = require('path')
var fs = require('fs')
module.exports = {
entry: {
View keybase.md

Keybase proof

I hereby claim:

  • I am adekbadek on github.
  • I am adamboro (https://keybase.io/adamboro) on keybase.
  • I have a public key whose fingerprint is 0184 5B0B 5DA3 FC5F B7A6 1B2B EAD0 EECF FEF4 E0A3

To claim this, I am signing this object:

View caesar-vigenere.js
const a = 'abcdefghijklmnopqrstuvwxyz'
const ceasar = (str, rot) => {
return str.split('').map((letter) => {
if (a.indexOf(letter.toLowerCase()) < 0) {
return letter
}
let rotLetter = a[(a.indexOf(letter.toLowerCase()) + rot) % a.length]
return letter.toLowerCase() === letter ? rotLetter : rotLetter.toUpperCase()
View times_converter.js
// in each paragraph, add a 24h-formatted time and convert from EST to Central Europe time.
// BEWARE between Mar 13 and Mar 26 USA already change to DST, while Poland still waits. Next funkyzeit in Nov.
$('p').each(function(){
var match = $(this).html().match(/([\w]*):([\w]*) ([\w]*)/)
if(match != null && match.length >= 0){
var h = match[1]
var m = match[2]
var ap = match[3]
View pascal_newton.js
// Print n lines of Pascal's triangle
// just a factorial function
function fa(num) {
if (num === 0){ return 1; }
else{ return num * fa( num - 1 ); }
}
// Binomial coefficient
function newt(n, k){
@adekbadek
adekbadek / screenshots.coffee
Last active Jan 26, 2016 — forked from nhoizey/screenshots.js
Take screenshots at different viewport sizes using CasperJS
View screenshots.coffee
###
# Takes provided URL passed as argument and make screenshots of this page with several viewport sizes.
# These viewport sizes are arbitrary, taken from iPhone & iPad specs, modify the array as needed
#
# Original gist by nhoizey: https://gist.github.com/nhoizey/4060568
#
# Usage:
# $ casperjs screenshots.coffee [--atf] [--url=URL]
# with SlimerJS - it has better feature support than the default PhantomJS
# $ casperjs --engine=slimerjs test.coffee [--atf] [--url=URL]
View pascal_recursive.js
// Print n lines of Pascal's triangle
function new_line(line){
// function takes the last line and based on that creates the next one
var new_line_array = [],
next_int;
// iterate over the line, which is an array of integers
for(var i=0; i<line.length; i++ ){
var a = parseInt(line[i]);
var b = parseInt(line[i-1]);
You can’t perform that action at this time.