Skip to content

Instantly share code, notes, and snippets.

View ccdd13's full-sized avatar
🥑
still eating 🥑 🥑

ccdd13 ccdd13

🥑
still eating 🥑 🥑
View GitHub Profile
<?php
/**
*
*/
include '__header.php';
?>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1.3");
@maxparm
maxparm / test.js
Created July 26, 2011 22:14
JS - Boolean values in javascript conditions
// Boolean Value
console.log('===== Boolean Value!');
console.log( ( 1 ) ? 'true' : 'false' ); // true
console.log( ( '0' ) ? 'true' : 'false' ); // true
console.log( ( '1' ) ? 'true' : 'false' ); // true
console.log( ( [] ) ? 'true' : 'false' ); // true
console.log( ( {} ) ? 'true' : 'false' ); // true
console.log( ( '' ) ? 'true' : 'false' ); // false
console.log( ( 0 ) ? 'true' : 'false' ); // false
console.log( ( NaN ) ? 'true' : 'false' ); // false
@cdown
cdown / gist:1163649
Last active September 25, 2024 14:24
Bash urlencode and urldecode
urlencode() {
# urlencode <string>
old_lc_collate=$LC_COLLATE
LC_COLLATE=C
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:$i:1}"
case $c in
@paulmillr
paulmillr / active.md
Last active October 11, 2024 01:14
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The list would not be updated for now. Don't write comments.

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Because of GitHub search limitations, only 1000 first users according to amount of followers are included. If you are not in the list you don't have enough followers. See raw data and source code. Algorithm in pseudocode:

githubUsers
@lsauer
lsauer / parseInt.py
Last active April 3, 2022 09:11
Python: JavaScript like parseInt function in one line
#lsauer.com, 2013
#Note: -)for convenience the function uses the re-module, but can be rewritten to fit into a lambda expression
# -)choose any other, more-expressive return type such as NumPy's `nan` over None if you like
#demonstrative-version:
def parseInt(sin):
import re
return int(''.join([c for c in re.split(r'[,.]',str(sin))[0] if c.isdigit()])) if re.match(r'\d+', str(sin), re.M) and not callable(sin) else None
#via a simple regex:
@rxaviers
rxaviers / gist:7360908
Last active October 19, 2024 22:42
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@rmohr
rmohr / simple_pam_auth.c
Last active April 22, 2024 08:03
Absolutely minimalistic pam authentication example
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <unistd.h> /* getpass */
#include <security/pam_appl.h> /* pam_start, pam_conv, pam_end, ... */
#define TRY(x) ret = (x); printf("PAM: %s\n", pam_strerror(handle, ret)); if (ret != PAM_SUCCESS) goto finally
int test_conv(int num_msg, const struct pam_message **msg,
@ckressibucher
ckressibucher / cliserver.php
Last active August 27, 2024 12:44
Router script for PHP built in server
<?php
// public/cliserver.php (router script)
if (php_sapi_name() !== 'cli-server') {
die('this is only for the php development server');
}
if (is_file($_SERVER['DOCUMENT_ROOT'].'/'.$_SERVER['SCRIPT_NAME'])) {
// probably a static file...
return false;
anonymous
anonymous / .bashrc
Created September 27, 2016 19:19
How to change cursor shape, color, and blinkrate of Linux Console
##############
# pretty prompt and font colors
##############
# alter the default colors to make them a bit prettier
echo -en "\e]P0000000" #black
echo -en "\e]P1D75F5F" #darkred
echo -en "\e]P287AF5F" #darkgreen
echo -en "\e]P3D7AF87" #brown
echo -en "\e]P48787AF" #darkblue
@84adam
84adam / gist:c08008900bb4f7f0d51ad6bfc663f75b
Created March 22, 2017 23:05
Calculate rounded percentage in bash using bc
CODE:
x=<FIRSTNUM>; y=<SECONDNUM>; printf $(echo "scale=4; $x/$y * 100" | bc | cut -d . -f 1)%%
EXAMPLE:
x=55; y=85; printf $(echo "scale=4; $x/$y * 100" | bc | cut -d . -f 1)%%
OUTPUT: