Skip to content

Instantly share code, notes, and snippets.

View ibraheemdev's full-sized avatar

Ibraheem Ahmed ibraheemdev

View GitHub Profile
@rxaviers
rxaviers / gist:7360908
Last active April 26, 2024 02:35
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:
@huonw
huonw / blackmagic.rs
Created January 15, 2014 12:42
do-while loops in Rust
while {
let x = foo();
bar(x);
x != 0
} {}
@niyazpk
niyazpk / pQuery.js
Created October 25, 2014 14:03
Add or update query string parameter
// Add / Update a key-value pair in the URL query parameters
function updateUrlParameter(uri, key, value) {
// remove the hash part before operating on the uri
var i = uri.indexOf('#');
var hash = i === -1 ? '' : uri.substr(i);
uri = i === -1 ? uri : uri.substr(0, i);
var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
var separator = uri.indexOf('?') !== -1 ? "&" : "?";
if (uri.match(re)) {
@mjohnsullivan
mjohnsullivan / http_server.rs
Last active March 12, 2024 16:08
Simple HTTP server example for Rust
// Updated example from http://rosettacode.org/wiki/Hello_world/Web_server#Rust
// to work with Rust 1.0 beta
use std::net::{TcpStream, TcpListener};
use std::io::{Read, Write};
use std::thread;
fn handle_read(mut stream: &TcpStream) {
let mut buf = [0u8 ;4096];
@qolop
qolop / factors.rs
Created July 8, 2016 15:12
A one liner to find factors of a number in Rust.
use std::io;
fn main() {
println!("Enter a number to find its factors: ");
let mut s = String::new();
io::stdin()
.read_line(&mut s)
.expect("failed to read line");
let num: u64 = s.trim().parse().expect("Enter in a positive integer only");
let factors = get_factors_functional(num);

About variadics in Rust

This is an analysis of how variadic generics could be added to Rust. It's not a proposal so much as a summary of existing work, and a toolbox for creating an eventual proposal.

Introduction

Variadic generics (aka variadic templates, or variadic tuples), are an often-requested feature that would enable traits, functions and data structures to be generic over a variable number of types.

To give a quick example, a Rust function with variadic generics might look like this: